Re: Several Questions

2009-06-02 Thread Ammar Ibrahim
On Tue, Jun 2, 2009 at 3:48 AM, Todd Heberlein wrote: > Great, so I understand from what you're saying that I can launch a GUI app >> using launchd? >> > > Out of curiosity, I just tried this. I created a basic Cocoa app (I made no > changes to it, I just built the default skeleton application tha

Re: Several Questions

2009-06-02 Thread Ammar Ibrahim
On Mon, Jun 1, 2009 at 2:58 PM, Jelle De Laender wrote: > why should your app stops responding? > > Do you want to detect time-outs (network-times, IO-timeouts, ...) or will > your app be crap and full with bugs? I find your answer irritating. All software Apps I've used do crash, even once in

Re: several questions about saving a bundle in an NSDocument based application

2009-06-01 Thread Michael Ash
On Tue, Jun 2, 2009 at 12:39 AM, Graham Cox wrote: > > On 02/06/2009, at 11:40 AM, Matthew Jeorrett wrote: > >> I have successfully implemented the NSDocument architecture in my >> application and have implemented saving and loading documents by overriding >> the "dataOfType:error:" and "readFromD

Re: several questions about saving a bundle in an NSDocument based application

2009-06-01 Thread Graham Cox
On 02/06/2009, at 11:40 AM, Matthew Jeorrett wrote: I have successfully implemented the NSDocument architecture in my application and have implemented saving and loading documents by overriding the "dataOfType:error:" and "readFromData:ofType:error:" methods. I now want to be able to expor

several questions about saving a bundle in an NSDocument based application

2009-06-01 Thread Matthew Jeorrett
Hi, I have successfully implemented the NSDocument architecture in my application and have implemented saving and loading documents by overriding the "dataOfType:error:" and "readFromData:ofType:error:" methods. I now want to be able to export my document into a folder selected by the user. Th

Re: Several Questions

2009-06-01 Thread Todd Heberlein
Great, so I understand from what you're saying that I can launch a GUI app using launchd? Out of curiosity, I just tried this. I created a basic Cocoa app (I made no changes to it, I just built the default skeleton application that Xcode creates for you). The project is in the directory:

Re: Several Questions

2009-06-01 Thread Todd Heberlein
FYI: I was looking through some Darwin mailing lists archives, and I ran across this posting about launchd at WWDC that may be of interest to this thread: Hello all, If you're attending WWDC and are interested in the BSD-level technologies in Mac OS X, I'm giving a talk on launchd this ye

Re: Several Questions

2009-06-01 Thread Todd Heberlein
why should your app stops responding? Do you want to detect time-outs (network-times, IO-timeouts, ...) or will your app be crap and full with bugs? I wish my code never had infinite loops (Apple's address:) or multithreaded deadlocks or other types of bugs... but sometimes sh*t happens.

Re: Several Questions

2009-06-01 Thread Michael Ash
On Mon, Jun 1, 2009 at 7:19 AM, Ammar Ibrahim wrote: > Great, so I understand from what you're saying that I can launch a GUI app > using launchd? I will look into it. Also, what if the application stops > responding? Is that something that launchd can detect? As far as I know, no, launchd can't

Re: Several Questions

2009-06-01 Thread Benjamin Dobson
On 1 Jun 2009, at 12:58:17, Jelle De Laender wrote: why should your app stops responding? Do you want to detect time-outs (network-times, IO-timeouts, ...) or will your app be crap and full with bugs? There will always be unforeseen circumstances. Better safe than sorry, right? Just be

Re: Several Questions

2009-06-01 Thread Jelle De Laender
why should your app stops responding? Do you want to detect time-outs (network-times, IO-timeouts, ...) or will your app be crap and full with bugs? On 01 Jun 2009, at 13:19, Ammar Ibrahim wrote: On Mon, Jun 1, 2009 at 6:04 AM, Chris Hanson wrote: On May 30, 2009, at 11:18 PM, Ammar Ib

Re: Several Questions

2009-06-01 Thread Ammar Ibrahim
On Mon, Jun 1, 2009 at 6:04 AM, Chris Hanson wrote: > On May 30, 2009, at 11:18 PM, Ammar Ibrahim wrote: > >> On Sun, May 31, 2009 at 6:16 AM, Chris Hanson wrote: >> >> The best way to ensure your daemon or agent is always running is to have >>> it >>> run via launchd. >>> >>> Start by reading

Re: Several Questions

2009-05-31 Thread Todd Heberlein
You can use launchd to keep your app alive. That way you, don't have to worry about adding code to your application to do it, you just have to ensure the launchd property list is in the right place. So if in your launchd module you have the key-value pair: KeepAlive will l

Re: Several Questions

2009-05-31 Thread Chris Hanson
On May 30, 2009, at 11:18 PM, Ammar Ibrahim wrote: On Sun, May 31, 2009 at 6:16 AM, Chris Hanson wrote: The best way to ensure your daemon or agent is always running is to have it run via launchd. Start by reading the launchd man page and the "Daemons and Agents" tech note; these will giv

Re: Several Questions

2009-05-31 Thread Greg Guerin
Gwynne Raskind wrote: Note that OS X's Force Quit command doesn't send SIGKILL immediately; I believe it sends SIGINT and SIGQUIT before resorting to SIGKILL, ... On 10.4 and 10.5, it sends SIGTERM before resorting to SIGKILL. In some earlier OS version, SIGINT may have been used instead

Re: Several Questions

2009-05-31 Thread Uli Kusterer
Am 31.05.2009 um 20:27 schrieb Gwynne Raskind: The Cocoa variant of the distributed notification is NSDistributedNotificationCenter :). I thought so, but it wasn't in NSNotification.h when I looked there, and there was no NSDistributedNotification.h. Figures that NSDistributedNotificatio

Re: Several Questions

2009-05-31 Thread Gwynne Raskind
On May 31, 2009, at 2:08 PM, Ammar Ibrahim wrote: Can you give us so more details? For example: What will the app do? Your description is very strange, lol. But indeed, you should create a normal cocoa app that do the stuff you want to do (UI + the real stuff), and a little daemon that checks

Re: Several Questions

2009-05-31 Thread Kyle Sluder
On Sun, May 31, 2009 at 11:08 AM, Ammar Ibrahim wrote: > This seems like a very doable approach. Anyhow, the daemon itself might > crash, so I would go for a cron job that runs say every 5 mins, We have launchd which already relaunches tasks that die. --Kyle Sluder __

Re: Several Questions

2009-05-31 Thread Ammar Ibrahim
On Sun, May 31, 2009 at 3:57 PM, Uli Kusterer wrote: > Am 31.05.2009 um 12:12 schrieb Jelle De Laender: > >> Can you give us so more details? For example: What will the app do? >> Your description is very strange, lol. >> >> But indeed, you should create a normal cocoa app that do the stuff you >>

Re: Several Questions

2009-05-31 Thread Uli Kusterer
Am 31.05.2009 um 12:12 schrieb Jelle De Laender: Can you give us so more details? For example: What will the app do? Your description is very strange, lol. But indeed, you should create a normal cocoa app that do the stuff you want to do (UI + the real stuff), and a little daemon that checks e

Re: Several Questions

2009-05-31 Thread Jelle De Laender
Can you give us so more details? For example: What will the app do? Your description is very strange, lol. But indeed, you should create a normal cocoa app that do the stuff you want to do (UI + the real stuff), and a little daemon that checks every X minutes if the other app is running:

Re: Several Questions

2009-05-31 Thread Alexander Spohr
Could you split your app in two? One would be a daemon that runs all times, the second a gui-frontend for the deamon. The problem seems to be that no one here can think of an app that has a gui that no one ever looks at. Why a gui at all if no one looks at it anyway? atze Am 31

Re: Several Questions

2009-05-30 Thread Ammar Ibrahim
But my app is a "normal" Cocoa App, it's not a daemon or an agent. On Sun, May 31, 2009 at 6:16 AM, Chris Hanson wrote: > The best way to ensure your daemon or agent is always running is to have it > run via launchd. > > Start by reading the launchd man page and the "Daemons and Agents" tech > n

Re: Several Questions

2009-05-30 Thread Ken Thomases
On May 30, 2009, at 7:57 PM, Ammar Ibrahim wrote: On Sun, May 31, 2009 at 3:27 AM, Kyle Sluder wrote: On Sat, May 30, 2009 at 5:20 PM, Ammar Ibrahim > wrote: 2- Is there a way to launch applications like iTunes from cocoa without the need to use AppleScript? Look at the NSWorkspace do

Re: Several Questions

2009-05-30 Thread Chris Hanson
The best way to ensure your daemon or agent is always running is to have it run via launchd. Start by reading the launchd man page and the "Daemons and Agents" tech note; these will give you an overview of how Mac OS X used launchd to manage these types of on-demand and always-on services.

Re: Several Questions

2009-05-30 Thread Todd Heberlein
Sorry about the confusion, yes I meant it will run normally but unattended. I need to make sure it recovers from any errors. in the worst case if it crashes, I need it to launch again automatically, even if there's 1 minute or whatever delay, it's absolutely fine. So it is a GUI app that w

Re: Several Questions

2009-05-30 Thread Ammar Ibrahim
On Sun, May 31, 2009 at 4:56 AM, Kyle Sluder wrote: > Well in that case I don't understand what you mean by "no users will > be using the system." Do you mean you intend for your application to > run normally but unattended? I interpreted what you said to mean you > were writing a background da

Re: Several Questions

2009-05-30 Thread Kyle Sluder
Well in that case I don't understand what you mean by "no users will be using the system." Do you mean you intend for your application to run normally but unattended? I interpreted what you said to mean you were writing a background daemon of some form. --Kyle Sluder

Re: Several Questions

2009-05-30 Thread Ammar Ibrahim
On Sun, May 31, 2009 at 4:02 AM, Kyle Sluder wrote: > If you're not writing an application that connects to the > WindowServer, you can't do things like AppleScript or controlling > other apps. You should read TN2083, "Daemons and Agents": > http://developer.apple.com/technotes/tn2005/tn2083.htm

Re: Several Questions

2009-05-30 Thread Kyle Sluder
If you're not writing an application that connects to the WindowServer, you can't do things like AppleScript or controlling other apps. You should read TN2083, "Daemons and Agents": http://developer.apple.com/technotes/tn2005/tn2083.html --Kyle Sluder _

Re: Several Questions

2009-05-30 Thread Ammar Ibrahim
On Sun, May 31, 2009 at 3:27 AM, Kyle Sluder wrote: > On Sat, May 30, 2009 at 5:20 PM, Ammar Ibrahim > wrote: > > 1- How do you ensure only one instance of your app is running? How do you > > detect if it stops responding? Can you restart it using something like a > > watchdog? And how would you

Re: Several Questions

2009-05-30 Thread Kyle Sluder
On Sat, May 30, 2009 at 5:20 PM, Ammar Ibrahim wrote: > 1- How do you ensure only one instance of your app is running? How do you > detect if it stops responding? Can you restart it using something like a > watchdog? And how would you go about implementing it? The system already does this for you

Several Questions

2009-05-30 Thread Ammar Ibrahim
Hello everyone, I'm writing an App, and I have the following list of questions, of which I couldn't find any satisfying answers elsewhere. 1- How do you ensure only one instance of your app is running? How do you detect if it stops responding? Can you restart it using something like a watchdog? An

Re: Manipulate the NSTextview, several questions...

2008-10-07 Thread Graham Cox
On 7 Oct 2008, at 6:50 pm, Cloud Strife wrote: Hi everyone. I am using the NSTextview to perform some functions of my application. I want to implement: 1. The NSTextiview has several lines of output, when the user click(or double-click) one line of the text, I want to the NSTextview to highli

Manipulate the NSTextview, several questions...

2008-10-07 Thread Cloud Strife
Hi everyone. I am using the NSTextview to perform some functions of my application. I want to implement: 1. The NSTextiview has several lines of output, when the user click(or double-click) one line of the text, I want to the NSTextview to highlight the line which the user clicked with some light c