Re: Cocoa daemon

2008-08-01 Thread Negm-Awad Amin

Hi,


I agree!

Even agents can take advantage of some frameworks, it is definetly no  
good idea to do any application (i.g. "ui-programm") stuff.


Amin

Am Fr,01.08.2008 um 21:52 schrieb Charles Srstka:


On Aug 1, 2008, at 2:28 PM, Jens Alfke wrote:

That class is in the AppKit framework. Daemons must not link  
against AppKit, or any other framework, like HLTB, that would  
connect to the window server. (I believe the big Daemons-and-Agents  
technote has a list of what frameworks are OK.)


The reason is that a daemon runs at a lower level of the system  
than the window server or a user login session. Daemons should not  
generally perform per-user functions because they don't run as a  
real user (typically they're either root, or a special-purpose  
pseudo-user like 'www'.)


If you want to run a background process on behalf of a particular  
login session, use an agent. This is much like writing a daemon  
except that you put the launchd plist in ~/Library/LaunchAgents or / 
Library/LaunchAgents.


Agents should also ideally not link against AppKit or connect to  
the WindowServer; this helps limit the system resources they use.  
If you really need to have a UI, such as an NSStatusItem, you  
should package your daemon in a .app bundle, using the LSUIElement  
Info.plist key so that it won't show up in the Dock.


Again, the technote describes all of this. It's definitely required  
reading if you're writing any kind of daemon/agent/background  
process.


As an illustration of the problems that can occur if you connect a  
daemon to the window server, there was a security hole until last  
night's security update that allowed any non-privileged app to send  
a "do shell script" command to a Cocoa app running as root, and run  
any arbitrary terminal command as root *without* using sudo,  
AuthorizationExecuteWithPrivileges(), or knowledge of any admin  
password. If one Cocoa app on the system was running as root,  
basically every process on the system that could send AppleScripts  
also had root access.


That particular bug's been fixed now (assuming you've downloaded and  
installed the latest security update), but there's no saying that  
similar not-yet-discovered issues won't crop up in the future,  
causing your daemon to be a vehicle for exploits. Better to make  
daemons link against Foundation only.


Charles
___

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

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

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

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Putting a spinning progress indicator in a outline

2008-08-01 Thread Markus Spoettl

On Aug 1, 2008, at 4:42 PM, Markus Spoettl wrote:
Thanks, that looks pretty good. I can't get it to work with binding  
right now, not sure why that is. When I bind to a bool property of  
the item object (which is KVC compliant) I get this logged:


8/1/08 4:06:37 PM myApp[1280] [  
valueForUndefinedKey:]: this class is not key value coding-compliant  
for the key value.


which - I guess means - that the cell is not compliant (because my  
value is). I can't find out a way to get the name of the key it is  
looking for, that would give me a clue as to what is missing. Any  
ideas?



Well to answer my own question, NSCell doesn't expose bindings, that's  
why I think it doesn't work. So either I manage to feed values to the  
column through the datasource delegate methods - which doesn't seem to  
work, can one even mix binding and datasource driven columns on a  
NSOutline? - or I have to add a value binding to the cell  
implementation.


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSDate, NSTimer, NSTimeInterval combined question

2008-08-01 Thread Ron Fleckner

Hi Eric,

The best thing to tell you to do, I think, is to read, or re-read,  
the documentation for NSTimer.  A timer (ie, an NSTimer instance)  
will fire when you tell it to.  In your startWatch: method, you've  
told it to fire every 0 (zero) seconds.  I don't think that's what  
you want.


In your -awakeFromNib, you're declaring a pointer to an NSTimer, but  
assigning a date to it.  I don't think that's what the timer wants.


HTH,

Ron


On 02/08/2008, at 3:31 PM, Eric Lee wrote:

I'm making a StopWatch, and I'm just a beginner, so please be  
patient with me.


I have two tabs. The first tab is a timer, while the second tab is  
a clock in string format. I have a few problems with both of them.


The problem with the timer is that it starts from January 1st,  
2001. How can I modify my code so that it'll start from 0, and then  
go upwards (1, 2, 3, 4, 5, 6, 7, etc...)?


I'll post my code below.

The problem with the clock is that it can post the time in string  
format, but it won't update every minute after that. I also use  
awakeFromNib to post it, because, like i said, I'm just a beginner  
(first programming language also).


Here's the code for the timer:

- (IBAction)startWatch:(id)sender

{
NSDate *currentDate = [NSDate date];

	timer = [NSTimer timerWithTimeInterval:0 target:self  
selector:@selector(updateTextfield:) userInfo:nil 			repeats: YES];
	[[NSRunLoop currentRunLoop] addTimer:timer forMode:  
NSDefaultRunLoopMode];

[timer setFireDate:currentDate];
[timer retain];
}


- (void)updateTextfield:(NSTimer *)timer

{

NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];

NSTimeInterval startTime;

NSTimeInterval difference = now - startTime;

NSString *timeString = [NSString stringWithFormat:@"%f", difference];

[textField setStringValue:timeString];
}


Here's the code for the clock:

- (void)awakeFromNib
{
NSDate *someDate = [NSDate date];
NSTimer *anotherTimer = [NSDate date];

[clock setStringValue:anotherTimer];
}


Thanks to everyone!
___

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

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

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


This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


re: NSDate, NSTimer, NSTimeInterval combined question

2008-08-01 Thread Allison Newman

Eric,

Without looking too closely, I see several problems, there may be  
others.


Firstly, in your updateTextfield method, you are using  
startTimewithout initialising it.


Secondly, in your timer callback (updateTextfield), you never update  
the value of your clock gadget, so of course it doesn't change.


Thirdly, as far as I can tell, you aren't correctly setting the  
interval for the timer - you seem to be setting it to 0.  I don't know  
what that does to the system.


When using a timer, I generaly find it easier to do this:
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self  
selector:updateTextfield userInfo:nil repeats: true];


This repets with an interval of 1.0 seconds (syntax may be wrong for  
the selector, I use RubyCocoa, not Objective-C).


Using this call, you don't need to use a runloop at all, it's all  
automagically handled for you.  All you need to do is call [timer  
invalidate] when you want to stop the timer.


Hope that helps.

Alli
___

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

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

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

This email sent to [EMAIL PROTECTED]


IKImageBrowser drag reordering question/problem

2008-08-01 Thread c. mendoza

Hey All,

I've successfully managed to use an IKImageBrowser in an app I am  
developing. My IKImageBrowserItem imageRepresentationType is 
IKImageBrowserPathRepresentationType, and everything works as  
advertised: I can drag-reorder and delete the images. However, when I  
try to use IKImageBrowserNSImageRepresentationType, the images are  
displayed and I can delete them, but I can no longer drag-reorder  
them. This is a real pain, because it means that I have to have all of  
the images I am using in the filesystem, instead of just in memory as  
NSImages. Now the question, is this a "feature" or a bug? I should add  
that I am newbie at Cocoa, and I am very impressed with it so far.


thanks,

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


NSDate, NSTimer, NSTimeInterval combined question

2008-08-01 Thread Eric Lee
I'm making a StopWatch, and I'm just a beginner, so please be patient  
with me.


I have two tabs. The first tab is a timer, while the second tab is a  
clock in string format. I have a few problems with both of them.


The problem with the timer is that it starts from January 1st, 2001.  
How can I modify my code so that it'll start from 0, and then go  
upwards (1, 2, 3, 4, 5, 6, 7, etc...)?


I'll post my code below.

The problem with the clock is that it can post the time in string  
format, but it won't update every minute after that. I also use  
awakeFromNib to post it, because, like i said, I'm just a beginner  
(first programming language also).


Here's the code for the timer:

- (IBAction)startWatch:(id)sender

{
NSDate *currentDate = [NSDate date];

	timer = [NSTimer timerWithTimeInterval:0 target:self  
selector:@selector(updateTextfield:) userInfo:nil 			repeats: YES];
	[[NSRunLoop currentRunLoop] addTimer:timer forMode:  
NSDefaultRunLoopMode];

[timer setFireDate:currentDate];
[timer retain];
}


- (void)updateTextfield:(NSTimer *)timer

{

NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];

NSTimeInterval startTime;

NSTimeInterval difference = now - startTime;

NSString *timeString = [NSString stringWithFormat:@"%f", difference];

[textField setStringValue:timeString];
}


Here's the code for the clock:

- (void)awakeFromNib
{
NSDate *someDate = [NSDate date];
NSTimer *anotherTimer = [NSDate date];

[clock setStringValue:anotherTimer];
}


Thanks to everyone!
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPopupButton and Interface Builder

2008-08-01 Thread Jens Alfke


On 1 Aug '08, at 9:46 PM, Andrew Zahra wrote:


I have an NSPopupButton in my user interface. I notice that Interface
Builder populates it with Item 1, 2, 3 - but where do I edit these  
values?


Double-click the pop-up view in IB and its menu will appear. Then you  
can edit it just like the menus in the menu bar.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPopupButton and Interface Builder

2008-08-01 Thread Andrew Zahra
I have an NSPopupButton in my user interface. I notice that Interface
Builder populates it with Item 1, 2, 3 - but where do I edit these values? I
have looked at the various tabs for the objects in its hierarchy, but I
can't find where they are specified.
Can someone point me in the right direction?

Thanks,
Andrew
___

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

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

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

This email sent to [EMAIL PROTECTED]


2 outline views, selection changes

2008-08-01 Thread Jack Carbaugh
I've been wracking my brain over this and after having too much  
caffeine and little results ...


I have 2 outline views and I'd like to have them operate such that  
selecting an item in OV#1, deselects any item(s) in OV#2 and vice versa.


I have tried many things in

- (void)outlineViewSelectionDidChange:(NSNotification *)notification

and in

- (void)outlineViewSelectionIsChanging:(NSNotification *)notification

however, when I try adjusting the selection in one view, it causes a  
loop where both end up having nothing selected.


I hope this makes sense.

Thanks for any advice.

Jack
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSArrayController and NStableView Binding

2008-08-01 Thread Revant Jain
Hi,

I have created a NSArrayController object which has the following
attributes:

Class Name: Person
Keys: personName, expectedRaise
ContentArray: employees

employees is a NSMutableArray contains references to Person objects.
employee is part of MyDocument class(subclass of NSDocument).

Now my NSTableView has to columns. The 1st column(person Name) is bound to
ArrangedObjects.personName. The 2nd column(Expected Raise) is bound to
ArrangedObjects.expectedRaise.

My window also has to button Add and Remove. On clicking add it adds another
Person object to ContentArray via (void)insertObject:(Person *)p
inEmployeesAtIndex:(int)index method in Mydocument class. Similarly for
Remove.

Now my Question was that when I double click on a cell in NSTableView to
edit it what method does it call in the MyDocument class(if any) to reflect
the edit onto the particular Person object?

If it does not call a method in MyDocument class how does it change the
instance variables of the particular Person object being edited? Does each
cell of the NSTableView have reference to its respective Person Object and
it just uses an accessor?

Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-01 Thread Jens Alfke


On 1 Aug '08, at 7:27 PM, JongAm Park wrote:

I measured the performance and found out that the most of the time  
were spent with the FSWriteFork() function.
Probably other parts should be streamlined also, but it would impact  
significantly if the file write can be faster.


You should sample the export process with both code paths (native FCP  
as well as with your plugin). Then you can find how much time each one  
takes in file I/O. fs_usage will also tell you how big the writes are  
and whether they're cached.


Uncached writes really can make a difference, especially if there's a  
lot of memory in use. A cached write will save each written page in  
RAM, which often forces an existing page to be evicted to make room;  
and if that page is dirty, it has to be written back to disk first.  
That can double the number of disk writes.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data saved doc compatibility issues ...

2008-08-01 Thread mmalc crawford


On Aug 1, 2008, at 8:27 PM, vince wrote:

Is this typical? IIf so my guess is potential customers will  
encounter major
problems as I distribute application updates. I'm not sure how to  
address

this.





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


Core Data saved doc compatibility issues ...

2008-08-01 Thread vince
I'm building a doc based Core Data application using bindings.

Question about this error:
"The document "New-db.sqlite" could not be opened. The managed object model
version used to open the persistent store is incompatible with the one that
was used to create the persistent store."

I receive this message each time I attempt to re-open a sqlite format
document that was created using a previous build of my Core Data project.
Specifically, the issue only surfaces if I make changes to the Entity
Properties in the project data model.

Is this typical? IIf so my guess is potential customers will encounter major
problems as I distribute application updates. I'm not sure how to address
this.

thanks for the help.

v.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-01 Thread JongAm Park

Thank you, Jens Alfke for your reply.

The function will write about 19200 bytes per every call. I'm going  
to write XDCAM 35 or 50 video data.
What is curious was that saving files as QuickTime movie format from  
the Final Cut Pro takes about 20 secs for 1 minutes of XDCAM 35 video  
source, but if it does so using a FCP plug-in of which source codes I  
work with takes about 35 seconds. There is a call back function which  
is called by th FCP, and I even tried converting it to multithreaded  
version, but it is still much slower than the FCP's own scheme.


I measured the performance and found out that the most of the time  
were spent with the FSWriteFork() function.
Probably other parts should be streamlined also, but it would impact  
significantly if the file write can be faster.


Thank you.

On Aug 1, 2008, at 6:04 PM, Jens Alfke wrote:



On 1 Aug '08, at 3:33 PM, JongAm Park wrote:

I have some codes which were written in Carbon and we want to make  
its performance faster.
I found out that most of the time is spent by a series of  
FSWriteFork() function. So, I would like to use any method which  
is faster than that.
fwrite is one option but I also looked up a Cocoa method,  
writeData message of the NSFileHandle.


All of those end up going through the same filesystem calls  
('write', primarily) in the kernel, so one's not going to be faster  
than another. I would expect fwrite to be a tiny bit slower because  
of the extra buffering that stdio does, and NSFileHandle will also  
be a little slower because of the overhead of calling Objective-C  
methods. But generally that wouldn't be noticeable.


What really makes a difference is how much data you write on each  
call — the more the better. It may also help to use uncached  
writes, if the file's not going to be read again soon.


The fs_usage tool can help you see what filesystem calls you're  
making and how much data is being sent in every call.


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-01 Thread Jens Alfke


On 1 Aug '08, at 3:33 PM, JongAm Park wrote:

I have some codes which were written in Carbon and we want to make  
its performance faster.
I found out that most of the time is spent by a series of  
FSWriteFork() function. So, I would like to use any method which is  
faster than that.
fwrite is one option but I also looked up a Cocoa method, writeData  
message of the NSFileHandle.


All of those end up going through the same filesystem calls ('write',  
primarily) in the kernel, so one's not going to be faster than  
another. I would expect fwrite to be a tiny bit slower because of the  
extra buffering that stdio does, and NSFileHandle will also be a  
little slower because of the overhead of calling Objective-C methods.  
But generally that wouldn't be noticeable.


What really makes a difference is how much data you write on each call  
— the more the better. It may also help to use uncached writes, if the  
file's not going to be read again soon.


The fs_usage tool can help you see what filesystem calls you're making  
and how much data is being sent in every call.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDistributedNotifications and scripting languages

2008-08-01 Thread Jens Alfke


On 1 Aug '08, at 3:11 PM, Recent Chaos Software wrote:

I was wondering if anyone had any ideas about sending notifications  
to Cocoa applications using either Ruby, or PHP? I want to send  
notifications using a cocoa application to another cocoa application  
and / or send notifications from a web based application.


AppleEvents are the standard way to do this. Cocoa's scriptability  
APIs make it pretty easy to implement AppleEvent/AppleScript support.  
From Ruby you can use the bridge to invoke AppleScript, and from any  
language you can launch an AppleScript as a separate task or use the  
'osascript' tool to send raw AppleEvents.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-01 Thread Nick Zitzmann


On Aug 1, 2008, at 4:33 PM, JongAm Park wrote:


Hello..


Ahnyong haseo,

I have some codes which were written in Carbon and we want to make  
its performance faster.
I found out that most of the time is spent by a series of  
FSWriteFork() function. So, I would like to use any method which is  
faster than that.
fwrite is one option but I also looked up a Cocoa method, writeData  
message of the NSFileHandle.


Does anyone know if the writeData's performance compared to the  
FSWriteFork()?



You could try it, but I don't see how it would make a difference,  
since these close-to-direct I/O functions tend to be limited to the  
speed of the output device rather than the CPU, unless they take  
advantage of a certain feature of the file system in use (see  
FSGetCatalogInfo()). Instead, you should probably re-evaluate how much  
& how often the software is writing to the disk, or switch to  
asynchronous I/O.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Putting a spinning progress indicator in a outline

2008-08-01 Thread Markus Spoettl

On Aug 1, 2008, at 2:55 PM, Jens Alfke wrote:
I'm trying to figure out how I might be able to do something like  
Mail.app does displaying a spinning progress indicator as part of  
an outline item. Is this a custom cell type that AppKit doesn't  
have or is it something that's already there waiting to be used?  
I'd be grateful is someone could push me in the right direction.


I think Mail uses a custom cell type. There's a 3rd party open- 
source implementation by Andreas Mayer, at

http://www.harmless.de/cocoa-code.php



Thanks, that looks pretty good. I can't get it to work with binding  
right now, not sure why that is. When I bind to a bool property of the  
item object (which is KVC compliant) I get this logged:


8/1/08 4:06:37 PM myApp[1280] [  
valueForUndefinedKey:]: this class is not key value coding-compliant  
for the key value.


which - I guess means - that the cell is not compliant (because my  
value is). I can't find out a way to get the name of the key it is  
looking for, that would give me a clue as to what is missing. Any ideas?


Thanks for the tip though!

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

[Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-01 Thread JongAm Park

Hello..

I have some codes which were written in Carbon and we want to make its 
performance faster.
I found out that most of the time is spent by a series of FSWriteFork() 
function. So, I would like to use any method which is faster than that.
fwrite is one option but I also looked up a Cocoa method, writeData 
message of the NSFileHandle.


Does anyone know if the writeData's performance compared to the 
FSWriteFork()?

Or can anyone suggest other methods to take?

Thank you.
JongAm Park
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Daniel Staal
--As of August 1, 2008 4:47:11 PM -0400, Michael Ash is alleged to have 
said:



A *pointer* to an object is just an address, like 0x12345678. This is
the address of the first byte in that blob of memory. A pointer
essentially lets you find that object in memory, but it is not the
object. Think of it as the difference between your friend Bob, and
your friend Bob's phone number. You can store Bob's phone number in
every room of your house, but there remains only one Bob. If you then
give Bob a present, the phone number in every room in the house will
reach the Bob who is pleased because you gave him a present.


--As for the rest, it is mine.

...And, to continue the analogy, having the phone number and the general 
line is generally easier to use and less likely to be a problem then 
nailing a hardwired line direct to (and that can only reach) Bob in.


Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSDistributedNotifications and scripting languages

2008-08-01 Thread Recent Chaos Software

Hello Everyone,

I was wondering if anyone had any ideas about sending notifications to  
Cocoa applications using either Ruby, or PHP? I want to send  
notifications using a cocoa application to another cocoa application  
and / or send notifications from a web based application.


I have looked into SOAP and XML-RPC but that doesn't seem to be the  
best resources for the solution. Any pointers / suggestions would be  
greatly appreciated.


Thanks,

Rick
Recent Chaos Software
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Putting a spinning progress indicator in a outline

2008-08-01 Thread Jens Alfke


On 1 Aug '08, at 2:49 PM, Markus Spoettl wrote:

I'm trying to figure out how I might be able to do something like  
Mail.app does displaying a spinning progress indicator as part of an  
outline item. Is this a custom cell type that AppKit doesn't have or  
is it something that's already there waiting to be used? I'd be  
grateful is someone could push me in the right direction.


I think Mail uses a custom cell type. There's a 3rd party open-source  
implementation by Andreas Mayer, at

http://www.harmless.de/cocoa-code.php

—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Putting a spinning progress indicator in a outline

2008-08-01 Thread Markus Spoettl

Hello List,

 I'm trying to figure out how I might be able to do something like  
Mail.app does displaying a spinning progress indicator as part of an  
outline item. Is this a custom cell type that AppKit doesn't have or  
is it something that's already there waiting to be used? I'd be  
grateful is someone could push me in the right direction.


Thanks!
Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: pointers in objective-c?

2008-08-01 Thread Sherm Pendley
On Fri, Aug 1, 2008 at 3:38 PM, Arthur Coleman <[EMAIL PROTECTED]> wrote:
> I hate to be dense, but what about C structs like NSRect?

There's nothing special about them - they can be allocated on the
stack or on the heap, just like any other C struct.

> There are initialized on the stack aren't they?

Unlike instance variables, which are initialized to 0, 0.0, or nil,
when an object is allocated, stack variables are *not* initialized to
any particular value. That's why it's a good idea to initialize them
yourself when you declare them:

-(void)foo {
id bar = nil;
id baz;

// Do stuff
}

In the above, bar will always be nil when you get to the "Do stuff"
code. But the value of baz will be whatever happened to be at that
location on the stack before you called -foo.

sherm--

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

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-08-01 Thread Hamish Allan
On Fri, Aug 1, 2008 at 1:02 AM, Chris Suter <[EMAIL PROTECTED]> wrote:

> The reason you're seeing the error is because as soon as you receive the
> response in your client, you're printing it and terminating the application
> but the server is expecting a response (even though the method has a void
> return value).

Ah, of course. Many thanks!

> To fix it, add the oneway qualifier to your setAnswerText: method.
> I think it would also be prudent to make sure that the client shuts down
> gracefully, i.e. call [connection invalidate] at least.
> You might want to go through your other methods and consider whether the
> oneway qualifier should apply. You could do the same for "bycopy".

Will do. Thanks again!

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Michael Ash
On Fri, Aug 1, 2008 at 2:43 PM, Wayne Shao <[EMAIL PROTECTED]> wrote:
> It seems that every object is a pointer in the sample code I have
> seen.  Is there any distinction between an object and its pointer?

Others have addressed the general concepts involved, but I wanted to
answer this question specifically.

There is a distinction between an object and its pointer, an important
distinction. An object is a blob of memory with a certain layout. That
layout is determined by the instance variables of the class, including
all of its superclasses. The first item in the blob is always the
'isa' instance variable, which points to the object's class. This is
how the runtime knows what kind of object you're dealing with, even
when you pass things around as 'id'. The remaining items are the rest
of the instance variables.

A *pointer* to an object is just an address, like 0x12345678. This is
the address of the first byte in that blob of memory. A pointer
essentially lets you find that object in memory, but it is not the
object. Think of it as the difference between your friend Bob, and
your friend Bob's phone number. You can store Bob's phone number in
every room of your house, but there remains only one Bob. If you then
give Bob a present, the phone number in every room in the house will
reach the Bob who is pleased because you gave him a present.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Glenn English

Arthur Coleman wrote:


No, it won't compile:


Like I said: my understanding. Now updated :-)

I knew that somebody whined at me when I forgot the '*', but I 
remembered it as a warning...


Thanks for the cluebat.

--
Glenn English
[EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Clark S. Cox III
The NS prefix is used for just about every external symbol in the  
frameworks (classes, structs, enums, typedefs, etc.). NS just tells  
you where the symbol came from, not whether or not the symbol is a  
classname.


Sent from my iPhone

On Aug 1, 2008, at 13:07, "Giulio Cesare Solaroli" <[EMAIL PROTECTED] 
> wrote:


On Fri, Aug 1, 2008 at 10:01 PM, Clark Cox <[EMAIL PROTECTED]>  
wrote:
On Fri, Aug 1, 2008 at 12:38 PM, Arthur Coleman <[EMAIL PROTECTED]>  
wrote:

I hate to be dense, but what about C structs like NSRect?  There are
initialized on the stack aren't they?


They're C structs, they aren't Objective-C objects.


That's very true, but the common NS prefix used by both full obj-c
classes and simple C structures may lead to some confusion, mainly for
someone learning obj-c and Cocoa.

Giulio Cesare

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Giulio Cesare Solaroli
On Fri, Aug 1, 2008 at 10:01 PM, Clark Cox <[EMAIL PROTECTED]> wrote:
> On Fri, Aug 1, 2008 at 12:38 PM, Arthur Coleman <[EMAIL PROTECTED]> wrote:
>> I hate to be dense, but what about C structs like NSRect?  There are
>> initialized on the stack aren't they?
>
> They're C structs, they aren't Objective-C objects.

That's very true, but the common NS prefix used by both full obj-c
classes and simple C structures may lead to some confusion, mainly for
someone learning obj-c and Cocoa.

Giulio Cesare
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Clark Cox
On Fri, Aug 1, 2008 at 12:38 PM, Arthur Coleman <[EMAIL PROTECTED]> wrote:
> I hate to be dense, but what about C structs like NSRect?  There are
> initialized on the stack aren't they?

They're C structs, they aren't Objective-C objects.

-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa daemon

2008-08-01 Thread Charles Srstka

On Aug 1, 2008, at 2:28 PM, Jens Alfke wrote:

That class is in the AppKit framework. Daemons must not link against  
AppKit, or any other framework, like HLTB, that would connect to the  
window server. (I believe the big Daemons-and-Agents technote has a  
list of what frameworks are OK.)


The reason is that a daemon runs at a lower level of the system than  
the window server or a user login session. Daemons should not  
generally perform per-user functions because they don't run as a  
real user (typically they're either root, or a special-purpose  
pseudo-user like 'www'.)


If you want to run a background process on behalf of a particular  
login session, use an agent. This is much like writing a daemon  
except that you put the launchd plist in ~/Library/LaunchAgents or / 
Library/LaunchAgents.


Agents should also ideally not link against AppKit or connect to the  
WindowServer; this helps limit the system resources they use. If you  
really need to have a UI, such as an NSStatusItem, you should  
package your daemon in a .app bundle, using the LSUIElement  
Info.plist key so that it won't show up in the Dock.


Again, the technote describes all of this. It's definitely required  
reading if you're writing any kind of daemon/agent/background process.


As an illustration of the problems that can occur if you connect a  
daemon to the window server, there was a security hole until last  
night's security update that allowed any non-privileged app to send a  
"do shell script" command to a Cocoa app running as root, and run any  
arbitrary terminal command as root *without* using sudo,  
AuthorizationExecuteWithPrivileges(), or knowledge of any admin  
password. If one Cocoa app on the system was running as root,  
basically every process on the system that could send AppleScripts  
also had root access.


That particular bug's been fixed now (assuming you've downloaded and  
installed the latest security update), but there's no saying that  
similar not-yet-discovered issues won't crop up in the future, causing  
your daemon to be a vehicle for exploits. Better to make daemons link  
against Foundation only.


Charles
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Arthur Coleman
I hate to be dense, but what about C structs like NSRect?  There are  
initialized on the stack aren't they?


Arthur

On Aug 1, 2008, at 12:24 PM, Clark S. Cox III wrote:



On Aug 1, 2008, at 12:10 PM, Glenn English wrote:


Wayne Shao wrote:

It seems that every object is a pointer in the sample code I have
seen.  Is there any distinction between an object and its pointer?
In C++,  C* c; would be an uninitialized pointer. But the following
line will creates an object with the constructor C().
C c;
It seems that there is no such equivalent syntax in Objective-C.
objects are created either from factory pattern or  [[A alloc]
someInitMethod ];
so, is it possible to write?
NSString a;
NSNumber b;


Sure. And it'll even compile. But you'd better not try to do much  
with them:-)


No, it won't compile:

[EMAIL PROTECTED]:~]% cat test.m
#import 

int main()
{
NSString s;

return 0;
}
[EMAIL PROTECTED]:~]% cc test.m
test.m: In function ‘main’:
test.m:5: error: statically allocated instance of Objective-C class  
‘NSString’




--
Clark S. Cox III
[EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa daemon

2008-08-01 Thread Jens Alfke


On 1 Aug '08, at 5:17 AM, Ivan C Myrvold wrote:


I try to implement the menu in the NSStatusBar systemStatusBar.


That class is in the AppKit framework. Daemons must not link against  
AppKit, or any other framework, like HLTB, that would connect to the  
window server. (I believe the big Daemons-and-Agents technote has a  
list of what frameworks are OK.)


The reason is that a daemon runs at a lower level of the system than  
the window server or a user login session. Daemons should not  
generally perform per-user functions because they don't run as a real  
user (typically they're either root, or a special-purpose pseudo-user  
like 'www'.)


If you want to run a background process on behalf of a particular  
login session, use an agent. This is much like writing a daemon except  
that you put the launchd plist in ~/Library/LaunchAgents or /Library/ 
LaunchAgents.


Agents should also ideally not link against AppKit or connect to the  
WindowServer; this helps limit the system resources they use. If you  
really need to have a UI, such as an NSStatusItem, you should package  
your daemon in a .app bundle, using the LSUIElement Info.plist key so  
that it won't show up in the Dock.


Again, the technote describes all of this. It's definitely required  
reading if you're writing any kind of daemon/agent/background process.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Clark S. Cox III


On Aug 1, 2008, at 12:10 PM, Glenn English wrote:


Wayne Shao wrote:

It seems that every object is a pointer in the sample code I have
seen.  Is there any distinction between an object and its pointer?
In C++,  C* c; would be an uninitialized pointer. But the following
line will creates an object with the constructor C().
C c;
It seems that there is no such equivalent syntax in Objective-C.
objects are created either from factory pattern or  [[A alloc]
someInitMethod ];
so, is it possible to write?
NSString a;
NSNumber b;


Sure. And it'll even compile. But you'd better not try to do much  
with them:-)


No, it won't compile:

[EMAIL PROTECTED]:~]% cat test.m
#import 

int main()
{
NSString s;

return 0;
}
[EMAIL PROTECTED]:~]% cc test.m
test.m: In function ‘main’:
test.m:5: error: statically allocated instance of Objective-C class  
‘NSString’




--
Clark S. Cox III
[EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Jens Alfke


On 1 Aug '08, at 11:54 AM, Clark S. Cox III wrote:

There are ways to trick the runtime into treating an area of the  
stack as of it were an object, but the caviats are a list as long as  
my arm--it's just not worth it.


Yup. The main problem is refcounting — if there were still references  
to such an object at the time that its stack frame exited, the program  
would be hosed, because the object's storage would unavoidably be gone.


In addition, support for stack-based objects inevitably ends up  
requiring all sorts of other runtime support to handle situations like  
passing the object by value as a function parameter, returning it from  
a function, embedding it inside another object, and so on. That's why C 
++ has tricky things like copy constructors and member initialization  
clauses.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Glenn English

Wayne Shao wrote:

It seems that every object is a pointer in the sample code I have
seen.  Is there any distinction between an object and its pointer?

In C++,  C* c; would be an uninitialized pointer. But the following
line will creates an object with the constructor C().

C c;

It seems that there is no such equivalent syntax in Objective-C.
objects are created either from factory pattern or  [[A alloc]
someInitMethod ];
so, is it possible to write?

NSString a;
NSNumber b;


Sure. And it'll even compile. But you'd better not try to do much with 
them:-)




Objects in o-c are just plain old structs. And to get to them, you have 
to have a pointer.


And the C++ syntax you refer to doesn't exist in o-c. At least it 
doesn't do what it does in C++.


So C* c is indeed an uninitialized pointer to a C, just like it says it 
is. And C c declares a struct of type C that you can't do anything with, 
also just like it says.


C* c = [C new] (or equivalent) is the way do some useful work...



--
Glenn English
[EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Clark S. Cox III
Correct, all objective-C objects are allocated on the heap (like using  
new in C++). The compiler will not allow you to allocate objects on  
the stack.


There are ways to trick the runtime into treating an area of the stack  
as of it were an object, but the caviats are a list as long as my arm-- 
it's just not worth it.


Sent from my iPhone

On Aug 1, 2008, at 11:43, "Wayne Shao" <[EMAIL PROTECTED]> wrote:


It seems that every object is a pointer in the sample code I have
seen.  Is there any distinction between an object and its pointer?

In C++,  C* c; would be an uninitialized pointer. But the following
line will creates an object with the constructor C().

C c;

It seems that there is no such equivalent syntax in Objective-C.
objects are created either from factory pattern or  [[A alloc]
someInitMethod ];
so, is it possible to write?

NSString a;
NSNumber b;

--Wayne
___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: pointers in objective-c?

2008-08-01 Thread Ken Thomases

On Aug 1, 2008, at 1:43 PM, Wayne Shao wrote:


It seems that every object is a pointer in the sample code I have
seen.  Is there any distinction between an object and its pointer?

In C++,  C* c; would be an uninitialized pointer. But the following
line will creates an object with the constructor C().

C c;

It seems that there is no such equivalent syntax in Objective-C.
objects are created either from factory pattern or  [[A alloc]
someInitMethod ];
so, is it possible to write?

NSString a;
NSNumber b;


It's possible to get into an esoteric discussion of what's technically  
possible (believe me, it's happened), but the useful answer is: all  
objects in Objective-C are dynamically allocated from the heap.  As  
you observed, you get objects using +alloc... methods (or a  
convenience method which wraps such an allocation).


Cheers,
Ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


pointers in objective-c?

2008-08-01 Thread Wayne Shao
It seems that every object is a pointer in the sample code I have
seen.  Is there any distinction between an object and its pointer?

In C++,  C* c; would be an uninitialized pointer. But the following
line will creates an object with the constructor C().

C c;

It seems that there is no such equivalent syntax in Objective-C.
objects are created either from factory pattern or  [[A alloc]
someInitMethod ];
so, is it possible to write?

NSString a;
NSNumber b;

--Wayne
___

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

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

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

This email sent to [EMAIL PROTECTED]


Searchkit: adding metadata

2008-08-01 Thread chaitanya pandit

Hi,
In my application i have to add number of images to the search index  
using searchKit, but i want to add other information (metadata) about  
the images in the search index, like suppose a name which will be  
different that the image's file name in it's file path.
I tried using SKIndexSetDocumentProperties, and passing the name of  
the image when i create a SKDocumentRef. But it doesn't work.

Any idea of an ideal way to do this?
Thanks,
Chaitanya
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa daemon

2008-08-01 Thread Daniel Richman

Correct. You need to make an agent, not a daemon.

Daniel


Geoff Beier wrote:

On Fri, Aug 1, 2008 at 6:11 AM, Ivan C Myrvold <[EMAIL PROTECTED]> wrote:
  

I have developed a daemon which is launched by launchd. It have no user
interface, other than putting up a status menu with an icon at the status
bar.



That counts as user interface. You can't do that from a daemon.
Display your status menu from and agent that runs in the user's
context.

http://developer.apple.com/technotes/tn2005/tn2083.html#SECDAEMONS

HTH,

Geoff
___

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

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

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

This email sent to [EMAIL PROTECTED]
  

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: compiler warning for not fully implementing protocol

2008-08-01 Thread Adam R. Maxwell


On Aug 1, 2008, at 3:53 AM, Mark Sanvitale wrote:


I copied your code from Mail and pasted it into a text file.

[ip193:~/Desktop] mas% cc test.m -framework Foundation -o test
test.m:33: warning: incomplete implementation of class  
'PortalActionView'

test.m:33: warning: method definition for '-displayCapture' not found
test.m:33: warning: class 'PortalActionView' does not fully  
implement the 'ReadArchiveClient' protocol


[...]

Of course, perhaps these warnings are not actually being output on  
other systems.  I am running 10.4.11, 'cc --version':
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build  
5370).


I don't see the warnings, so that might be it; I'm on 10.5.4, with a  
slightly newer gcc: i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple  
Inc. build 5488).


--
Adam

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: interrupting a thread/run loop

2008-08-01 Thread Jean-Daniel Dupas


Le 1 août 08 à 14:52, Ken Thomases a écrit :


On Aug 1, 2008, at 6:43 AM, Chris Idou wrote:

I have a Cocoa thread waiting on events in a run loop. But I want  
to be able to give the waiting thread a "kick" to make it wake up  
and re-load its context.


I realise I could write my own custom run loop input source, but it  
seems like overkill if I could install a simple run loop observer  
and somehow just wake it up when I want it to re-initialize. Is  
there a way to do that?


You don't have to write a custom run-loop source.  Just add an  
NSPort instance as a source and message it for the "kick".


Cheers,
Ken


Yes, and on 10.5, you can also use the method - [NSObject  
performSelector:onThread:withObject:waitUntilDone:], that will wake up  
the target thread runloop.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: interrupting a thread/run loop

2008-08-01 Thread Ken Thomases

On Aug 1, 2008, at 6:43 AM, Chris Idou wrote:

I have a Cocoa thread waiting on events in a run loop. But I want to  
be able to give the waiting thread a "kick" to make it wake up and  
re-load its context.


I realise I could write my own custom run loop input source, but it  
seems like overkill if I could install a simple run loop observer  
and somehow just wake it up when I want it to re-initialize. Is  
there a way to do that?


You don't have to write a custom run-loop source.  Just add an NSPort  
instance as a source and message it for the "kick".


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa daemon

2008-08-01 Thread Geoff Beier
On Fri, Aug 1, 2008 at 6:11 AM, Ivan C Myrvold <[EMAIL PROTECTED]> wrote:
> I have developed a daemon which is launched by launchd. It have no user
> interface, other than putting up a status menu with an icon at the status
> bar.

That counts as user interface. You can't do that from a daemon.
Display your status menu from and agent that runs in the user's
context.

http://developer.apple.com/technotes/tn2005/tn2083.html#SECDAEMONS

HTH,

Geoff
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa daemon

2008-08-01 Thread Ivan C Myrvold

I try to implement the menu in the NSStatusBar systemStatusBar.

I would appreciate if anyone have any hint as to why the menu will not  
drop down, and show the menu items.

Must be something I am missing here.

Ivan

Den 1. aug.. 2008 kl. 12:32 skrev Negm-Awad Amin:


Hi,

I do not think, that a daemon is the right place to implement a UI.  
It is the definition of an deamon, that it has no UI.

http://en.wikipedia.org/wiki/Daemon_%28computer_software%29

Build a front-end is the better design.

Cheers


Am Fr,01.08.2008 um 12:11 schrieb Ivan C Myrvold:

I have developed a daemon which is launched by launchd. It have no  
user interface, other than putting up a status menu with an icon at  
the status bar.

The menu icon is showing up, but nothing happens when I click it.

NSLog shows that the menu exists, and have items in it. I have the  
same code for making a status menu in an ordinary Cocoa  
application, and there I have no such problem.


2008-08-01 11:46:09.073 tansad[10413:10b] rebuildTansaItemMenu 2  
tansaMenu: 

Title: Tansa
Supermenu: 0x0 (None), autoenable: YES, change messages enabled: YES
Items: (
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  
  )

Ivan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]







___

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

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

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

This email sent to [EMAIL PROTECTED]


interrupting a thread/run loop

2008-08-01 Thread Chris Idou
In the Java thread API (which I am most familiar with) you put the thread in a 
wait() and then another thread can send the thread an interrupt() which makes 
it wake up and do stuff.

I have a Cocoa thread waiting on events in a run loop. But I want to be able to 
give the waiting thread a "kick" to make it wake up and re-load its context.

I realise I could write my own custom run loop input source, but it seems like 
overkill if I could install a simple run loop observer and somehow just wake it 
up when I want it to re-initialize. Is there a way to do that?





  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: compiler warning for not fully implementing protocol

2008-08-01 Thread Mark Sanvitale

I copied your code from Mail and pasted it into a text file.

[ip193:~/Desktop] mas% cc test.m -framework Foundation -o test
test.m:33: warning: incomplete implementation of class  
'PortalActionView'

test.m:33: warning: method definition for '-displayCapture' not found
test.m:33: warning: class 'PortalActionView' does not fully implement  
the 'ReadArchiveClient' protocol


Yes, you are correct that "PortalActionView conforms" is printed out  
when you run the resulting program.  That is exactly my point.   
Everything is fine.  The runtime knows it.  But at build time the  
compiler thinks otherwise.


Of course, perhaps these warnings are not actually being output on  
other systems.  I am running 10.4.11, 'cc --version':
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build  
5370).


But, hey, the warnings are harmless and can even be avoided with the  
elegant:


- (id)displayCapture { return [super displayCapture]; }

I will just write a bug and see what the powers that be think.

Thanks.


On Jul 31, 2008, at 8:13 PM, Adam R. Maxwell wrote:


On Jul 31, 2008, at 4:14 PM, Mark Sanvitale wrote:

I think I am doing exactly what you say is necessary (i.e. declare  
the second method in the superclass's public interface).


Here are some code snippets:


Turning your code snippets into a test program, I can't reproduce  
that compiler warning, or in a trivial test where the superclass  
declares/implements copyWithZone: and the subclass declares  
conformance.  If this works for you, what did I miss?



// File test.m, compile & run with `cc test.m -framework Foundation  
-o test && ./test`

#import 

@protocol PortalTabProtocol
- (void)refreshDisplay:(id)capture because:(int)trigger;
@end

@interface PortalTabView : NSObject 
- (NSString *)tabName;
- (void)refreshDisplay:(id)capture because:(int)trigger;
- (id)displayCapture;
@end

@protocol ReadArchiveClient
- (id)displayCapture;
- (void)processedArchive:(id)archive;
@end

@interface PortalActionView : PortalTabView 
@end

@implementation PortalTabView

- (NSString *)tabName; { return nil; }
- (void)refreshDisplay:(id)capture because:(int)trigger; {}
- (id)displayCapture; { return nil; }

@end

@implementation PortalActionView

- (void)processedArchive:(id)archive {}

@end

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

id obj = [[PortalActionView alloc] init];
if ([obj conformsToProtocol:@protocol(ReadArchiveClient)])
NSLog(@"PortalActionView conforms");
else
NSLog(@"PortalActionView does not conform");

[pool release];
return 0;
}



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa daemon

2008-08-01 Thread Negm-Awad Amin

Hi,

I do not think, that a daemon is the right place to implement a UI. It  
is the definition of an deamon, that it has no UI.

http://en.wikipedia.org/wiki/Daemon_%28computer_software%29

Build a front-end is the better design.

Cheers


Am Fr,01.08.2008 um 12:11 schrieb Ivan C Myrvold:

I have developed a daemon which is launched by launchd. It have no  
user interface, other than putting up a status menu with an icon at  
the status bar.

The menu icon is showing up, but nothing happens when I click it.

NSLog shows that the menu exists, and have items in it. I have the  
same code for making a status menu in an ordinary Cocoa application,  
and there I have no such problem.


2008-08-01 11:46:09.073 tansad[10413:10b] rebuildTansaItemMenu 2  
tansaMenu: 

Title: Tansa
Supermenu: 0x0 (None), autoenable: YES, change messages enabled: YES
Items: (
   ,
   ,
   ,
   ,
   ,
   ,
   ,
   ,
   
   )

Ivan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Cocoa daemon

2008-08-01 Thread Ivan C Myrvold
I have developed a daemon which is launched by launchd. It have no  
user interface, other than putting up a status menu with an icon at  
the status bar.

The menu icon is showing up, but nothing happens when I click it.

NSLog shows that the menu exists, and have items in it. I have the  
same code for making a status menu in an ordinary Cocoa application,  
and there I have no such problem.


2008-08-01 11:46:09.073 tansad[10413:10b] rebuildTansaItemMenu 2  
tansaMenu: 

Title: Tansa
Supermenu: 0x0 (None), autoenable: YES, change messages enabled: YES
Items: (
,
,
,
,
,
,
,
,

)

Ivan
___

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

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

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

This email sent to [EMAIL PROTECTED]