Re: Background Process?

2009-03-10 Thread Daniel Richman
Set your program as a User Agent with launchd on install (i.e., a login item). launchd will make sure your program is running when the user logs in. Then, take a look at the NSTimer docs to implement the every-so-often part of it. --Daniel Richman Pierce Freeman wrote: Hi everyone: I am

Re: Background Process?

2009-03-10 Thread Daniel Richman
Thanks for correcting me. I have a lot to learn about this. Kyle Sluder wrote: On Tue, Mar 10, 2009 at 9:24 PM, Daniel Richman applemaill...@mm.danielrichman.com wrote: Set your program as a User Agent with launchd on install (i.e., a login item). launchd will make sure your program

Re: NSString to Integer

2009-03-07 Thread Daniel Richman
I don't know what the default compile settings are for 64-bit machines, so I could be wrong. However, I think the default is 32-bit only, regardless of environment. You have to set the compiler to also compile 64-bit binaries in the Info window of the project (right click on your project name

Re: NSString to Integer

2009-03-07 Thread Daniel Richman
Thanks for correcting that. I'd forgotten that long long existed. --Daniel Richman Kyle Sluder wrote: On Sat, Mar 7, 2009 at 8:13 PM, Daniel Richman applemaill...@mm.danielrichman.com wrote: But your app could be running on a 32 bit only machine, so 64 bit is not a bet to make if you want

puzzled about speech synthesis

2009-01-22 Thread Daniel Richman
Hi all, I am trying to write an app that has a hard-coded NSString, formatted like this: @Alex: This is a test.\nBruce: One two.\nFred: This is another test. The idea is that the lines in the text are spoken using the indicated voice. In the example above, line one is Alex, line two is

Re: puzzled about speech synthesis [SOLVED]

2009-01-22 Thread Daniel Richman
I think this is it. Thank you so much. Daniel Roland King wrote: Daniel Richman wrote: Hi all, I am trying to write an app that has a hard-coded NSString, formatted like this: @Alex: This is a test.\nBruce: One two.\nFred: This is another test. The idea is that the lines in the text

Re: Right language

2008-11-30 Thread Daniel Richman
Another way of doing this: Cocoa Programming for Mac OS X talks about this specific thing. It's either the second-to-last or the last chapter, and it's entitled NSTask.It allows you to wrap around a shell command and get stdout and stderr. Obviously, if there's a framework, that's best, but

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

quit external application

2008-07-27 Thread Daniel Richman
Hi All, I have a simple question: what is the best way to quit another application? The app's name and exact path are known. I looked at NSWorkspace but couldn't find anything useful. Thanks, Daniel ___ Cocoa-dev mailing list

Re: quit external application

2008-07-27 Thread Daniel Richman
AppleEvents/AppleScript would be the ticket. Thanks! I used AppleScript. Just wasn't sure if there was some Cocoa class that did the job. Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

NSArray problems

2008-07-27 Thread Daniel Richman
Hi All, I've been having some strange problems with an NSArray. It's probably something obvious, but I can't figure it out. I have an AppController class with an NSArray instance value, called numbers. numbers stores NSStrings (which are numbers, but I don't need them as ints or anything).

Re: NSArray problems

2008-07-27 Thread Daniel Richman
I'd say you've either got a memory management issue, e.g. you're forgetting to retain numbers (are you using garbage collection?), or the debugger is getting confused and printing something else. That was it! I had forgotten to retain numbers. What confused me was that I was getting those

memory management

2008-07-26 Thread Daniel Richman
Hi All, I just finished reading the docs on memory management and want to make sure I got everything right (for non-GC apps): 1) Any object returned by new, alloc, copy or any derivates (mutableCopy, etc.) is 'yours.' You must release/autorelease it yourself. 2) Objects not returned by any

Re: Hillegass, Third Edition, Chapter 18

2008-07-15 Thread Daniel Richman
Stefan Arentz wrote: Hi Jon Just an aside - does Hillegass, Third Edition teach you Core Data? The blurb on Amazon says it does but when I looked at the index online it didn't mention Core Data. No it does not teach you Core Data. There are two Core Data chapters but they are more 'click

mysterious core data crash

2008-07-12 Thread Daniel Richman
Hi All, I'm trying to create a simple Core Data app. I've done this before with success. I'm using an NSArrayController set to Entity mode. The entity is a chemical with three string attributes: chemid, name, and description. In MyDocument.xib, I've created a table view and done all the

Re: mysterious core data crash

2008-07-12 Thread Daniel Richman
Of course. I actually realized this with chemid (it had been id) but I had completely forgotten about description. Thanks to all. Daniel mmalc Crawford wrote: On Jul 12, 2008, at 11:00 AM, Daniel Richman wrote: The entity is a chemical with three string attributes: chemid, name

starting external program at runtime

2008-07-11 Thread Daniel Richman
Hi All, I want to start an application (it's bundled with my main app) in a specific case. It was previously installed to a known location (it's a helper app, so I put it in ~/Library/Application Support -- was that the right thing to do?), so is there any class I can call upon, or is the

auxiliary window doesn't show again after first show

2008-07-05 Thread Daniel Richman
Hi All, I must be missing something blatantly obvious, but here goes: I made a Preferences window whose File's Owner is a custom class: PreferencesController, which is a subclass of NSWindowController. If you click on the Preferences menu item, the window is shown by [prefController

saving state of non-document-based agent

2008-07-02 Thread Daniel Richman
Hi All, I'm writing a program with a helper agent. The agent runs in the background, occasionally putting up alerts for the user to see. When the main program is running, it communicates information to the agent about what alerts to display. Then, the agent remembers this information after

Re: saving state of non-document-based agent

2008-07-02 Thread Daniel Richman
I thought of that, and it's certainly a possibility, but it seems mainly intended for preferences. I was wondering, before I turn to that, if there's some other way of doing it that's more designed for this. Thanks, Daniel I. Savant wrote: I need some way for the agent to save its list of

Re: saving state of non-document-based agent [solved]

2008-07-02 Thread Daniel Richman
Thanks! This is perfect. Ken Thomases wrote: On Jul 2, 2008, at 5:21 PM, Daniel Richman wrote: I thought of that, and it's certainly a possibility, but it seems mainly intended for preferences. I was wondering, before I turn to that, if there's some other way of doing it that's more

Re: class keeps track of object [solved]

2008-07-01 Thread Daniel Richman
; } @end Thats the simple single threaded case. Things get much more interesting if you want to be able to call 'bar' from multiple threads. Compiled in Mail - Jon Hess On Jul 1, 2008, at 3:35 PM, Daniel Richman wrote: Hi All, I have created a class (call it Foo

Re: Newbie question: Timers

2008-06-30 Thread Daniel Richman
Use this: NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 // number of seconds as double target:self // targer selector:@selector(checkTimer:) // selector to call (parameter is the timer) userInfo:nil // I don't use any user info repeats:YES]; // whether the timer repeats or is

Re: Clock-like looping

2008-06-29 Thread Daniel Richman
Use double newNumber = oldNumber % 13; This will return your number's remainder when dividing between 13, which could be 0 - 12. Daniel Ashley Perrien wrote: Is there a fairly simple way of setting up a clock style looping of numbers? Where 1-12 act normally but 11 + 2 would return 1 and

Re: Clock-like looping

2008-06-29 Thread Daniel Richman
Sorry, I just realized that won't work for floating point numbers. But you can check if the number is an integer first, then use the % operand if so. Daniel Daniel Richman wrote: Use double newNumber = oldNumber % 13; This will return your number's remainder when dividing between 13

Re: while loop with sleep(): logging works, but not UI events

2008-06-28 Thread Daniel Richman
--; } } Thanks again to all. Daniel Ken Thomases wrote: On Jun 27, 2008, at 10:55 PM, Daniel Richman wrote: I'm trying to program a simple timer app: you enter a number of seconds, and it updates a text field every second with the number of secs remaining. The problem is that I'm not able to do

Re: while loop with sleep(): logging works, but not UI events

2008-06-28 Thread Daniel Richman
One second seems to be accurate enough for my purposes, but I'll investigate using 0.5 seconds. Daniel Shawn Erickson wrote: On Sat, Jun 28, 2008 at 7:58 AM, Michael Ash [EMAIL PROTECTED] wrote: On Sat, Jun 28, 2008 at 12:10 AM, Shawn Erickson [EMAIL PROTECTED] wrote: Also you

Re: simple question about passing around pointers to objects

2008-06-27 Thread Daniel Richman
Here is a simple example: -(NSArray*) makeObject { NSArray *a = [NSArray arrayFromObjects];someObject, anotherObject, nil]; This should be NSArray *a = [NSArray arrayFromObjects:someObject, anotherObject]; // should I [a retain]; I would use [a retain]; // or [a release];

while loop with sleep(): logging works, but not UI events

2008-06-27 Thread Daniel Richman
Hi All, I'm trying to program a simple timer app: you enter a number of seconds, and it updates a text field every second with the number of secs remaining. The problem is that I'm not able to do anything with the UI while this is going on. Here's my code: - (IBAction)startTimer:(id)sender

NSDateFormatter -- accepting different formats at runtime

2008-06-23 Thread Daniel Richman
Hello All, I have an NSDateFormatter in an NSTableView. I would like the user to be able to enter dates in different ways, e.g. 1/2/07 January 17, 2008 I know it is possible to set how the date is formatted at compile time via IB, but is there any way to accept multiple formats at runtime?

Re: NIB Help

2008-06-23 Thread Daniel Richman
What do you mean, loading a NIB? Do you mean in Interface Builder, or at runtime? Daniel J. Todd Slack wrote: Hi All, Are there any examples of loading a NIB, accessing a tab view in a window of the NIB I just loaded? I was trying to accomplish via AppleScript originally, but nothing

Re: Wherefore art thou, o NSTableView?

2008-06-22 Thread Daniel Richman
You should implement -(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex The table view sends this message to you when one of its cells is being edited, and then you do whatever you want with the

Re: weird bug or feature?

2008-06-22 Thread Daniel Richman
Can you post your code for your main class? I've been doing the same thing and haven't had anything like that. Daniel William Squires wrote: Okay, here's a strange UI glitch. I have an Xcode project in which I have a to-do list (the challenge in Chapter 6 of the new Hillegaas book). I've

Re: A documentation dumdum

2008-06-22 Thread Daniel Richman
I think it's fine. This was my code for your exercise: -(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { NSLog(@Replacing '%@' with '%@', [toDoList objectAtIndex:rowIndex], anObject);

Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman
not an NSNumber. But I've seen a few errors confusing the two lately that didn't seem to happen before). hth, Graham On 21 Jun 2008, at 12:51 pm, Daniel Richman wrote: I've got an NSTableView that displays the data in an NSMutableArray. (The program is a to-do list.) I just tried adding a function

Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman
AM, Daniel Richman wrote: Thanks! I don't know why they introduced NSInteger. It sounds like it would be a subclass of NSNumber. That didn't seem to be the problem, though. The program still crashes only when you aren't deleting the first item. I made a movie of it; it's at http

Re: getting the selected object from an NSTableView causes problems

2008-06-21 Thread Daniel Richman
Ah. So the typedef changes depending on the platform. Interesting, thanks. Nick Zitzmann wrote: On Jun 21, 2008, at 9:13 AM, Daniel Richman wrote: Thanks! I don't know why they introduced NSInteger. It sounds like it would be a subclass of NSNumber. They did that so that NSData, etc

strikethrough in text displayed

2008-06-21 Thread Daniel Richman
Hi All, I was wondering if there's any way to put a strikethrough in text the program generates to put on screen (not something the user enters). For example, in HTML (I know this is a long way from that), you can use the strike and /strike tags. Is there anything to do that in Cocoa?

getting the selected object from an NSTableView causes problems

2008-06-20 Thread Daniel Richman
Hi All, I've got an NSTableView that displays the data in an NSMutableArray. (The program is a to-do list.) I just tried adding a function to allow you to delete an item: you select the item in the table and then click delete. My code is as follows: - (IBAction)deleteItem:(id)sender {

objects aren't added to NSMutableArray

2008-06-17 Thread Daniel Richman
I've got an object which has an NSMutableArray as an instance variable. If, in one of my methods, I try to call [myArray addObject:@this is a test]; (for example), I get no error, but the object isn't added. If I try to do [myArray objectAtIndex:0]; I get (null), and [myArray count];