Self contained command line tool

2012-10-12 Thread Charlie Dickman
I have created a command line tool that executes correctly in the debugger. How 
do I get the built binary to execute independently without starting the 
Terminal app.

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


System Menu Bar

2012-09-03 Thread Charlie Dickman
Is there a way to make the system menu bar transparent from within a cocoa app?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


App memory

2012-08-16 Thread Charlie Dickman
Is there a system command or any other way to get application memory stats like 
vm_stat does for the whole system?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: App memory

2012-08-16 Thread Charlie Dickman
Thanks. If integral max resident set size means the amount of memory being 
used then that's exactly what I want.

On Aug 16, 2012, at 11:30 AM, Stephen J. Butler wrote:

 getrusage?
 
 On Thu, Aug 16, 2012 at 9:39 AM, Charlie Dickman 3tothe...@comcast.net 
 wrote:
 Is there a system command or any other way to get application memory stats 
 like vm_stat does for the whole system?
 
 Charlie Dickman
 3tothe...@comcast.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:
 https://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com
 
 This email sent to stephen.but...@gmail.com

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Why no keyboard or mousedown events?

2012-08-15 Thread Charlie Dickman
When my app is running menu bar requests are honored in a timely fashion but 
neither keyboard shortcuts nor mouse clicks not in the menu bar are.
Can anybody tell me why and what to do about it?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Where do these come from...

2012-08-15 Thread Charlie Dickman
I have been getting the following messages in the console window while my 
program is running...

Wed Aug 15 11:13:51 charlie-dickmans-mac-pro.local Mah-Jongg[4416] Error: 
CGContextSetFillColorWithColor: invalid context 0x0
Wed Aug 15 11:13:51 charlie-dickmans-mac-pro.local Mah-Jongg[4416] Error: 
CGContextSetStrokeColorWithColor: invalid context 0x0
Wed Aug 15 11:13:51 charlie-dickmans-mac-pro.local Mah-Jongg[4416] Error: 
CGContextFillRects: invalid context 0x0
Wed Aug 15 11:13:51 charlie-dickmans-mac-pro.local Mah-Jongg[4416] Error: 
CGContextFillRects: invalid context 0x0

I have isolated their source to the following code...

[[NSColor whiteColor] set];
[die1 drawInRect: iDieDrawRect
  fromRect: imageRect1
 operation: NSCompositeSourceOver
  fraction: 1.0];
[die2 drawInRect: jDieDrawRect
  fromRect: imageRect2
 operation: NSCompositeSourceOver
  fraction: 1.0];

What can I do to eliminate these errors? I know the simple answer is to make 
the context valid but I don't know how to do that.

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Where do these come from...

2012-08-15 Thread Charlie Dickman
Here's the whole method... it is being called from within a view's drawRect 
method...

- (void) showDiceAtX: (float) x Y: (float) y {
NSRect imageRect1, imageRect2;
NSImage *die1 = nil, *die2 = nil;
iDie = iRand(1, 6);
switch (iDie) {
case 1:
die1 = [NSImage imageNamed: @1 Die];
break;
case 2:
die1 = [NSImage imageNamed: @2 Die];
break;
case 3:
die1 = [NSImage imageNamed: @3 Die];
break;
case 4:
die1 = [NSImage imageNamed: @4 Die];
break;
case 5:
die1 = [NSImage imageNamed: @5 Die];
break;
case 6:
die1 = [NSImage imageNamed: @6 Die];
}
jDie = iRand(1, 6);
switch (jDie) {
case 1:
die2 = [NSImage imageNamed: @1 Die];
break;
case 2:
die2 = [NSImage imageNamed: @2 Die];
break;
case 3:
die2 = [NSImage imageNamed: @3 Die];
break;
case 4:
die2 = [NSImage imageNamed: @4 Die];
break;
case 5:
die2 = [NSImage imageNamed: @5 Die];
break;
case 6:
die2 = [NSImage imageNamed: @6 Die];
}
imageRect1.origin = imageRect2.origin = NSZeroPoint;
imageRect1.size = [die1 size];
imageRect2.size = [die2 size];
/*
 * NSRect NSMakeRect(float x, float y, float w, float h)
 *
 * Creates an NSRect having the specified origin of [x, y] and size of 
[w, h]
 */
iDieDrawRect = NSMakeRect(x - imageRect1.size.width - 2, y, 
imageRect1.size.width, imageRect1.size.height);
jDieDrawRect = NSMakeRect(x + 2, y, imageRect2.size.width, 
imageRect2.size.height);

while (![self lockFocusIfCanDraw]) RELQ(.1);
[[NSColor whiteColor] set];
[die1 drawInRect: iDieDrawRect
  fromRect: imageRect1
 operation: NSCompositeSourceOver
  fraction: 1.0];
[die2 drawInRect: jDieDrawRect
  fromRect: imageRect2
 operation: NSCompositeSourceOver
  fraction: 1.0];
[self unlockFocus];
[[self window] flushWindow];
}

without the lockFocus the images never show.

On Aug 15, 2012, at 10:35 PM, Stephen J. Butler wrote:

 On Wed, Aug 15, 2012 at 10:20 AM, Charlie Dickman 3tothe...@comcast.net 
 wrote:
[[NSColor whiteColor] set];
[die1 drawInRect: iDieDrawRect
  fromRect: imageRect1
 operation: NSCompositeSourceOver
  fraction: 1.0];
[die2 drawInRect: jDieDrawRect
  fromRect: imageRect2
 operation: NSCompositeSourceOver
  fraction: 1.0];
 
 Where are these being called from in your program? What's the context
 of the surrounding code in the method?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Where do these come from...

2012-08-15 Thread Charlie Dickman
I DO NOT call drawRect directly. I DO  call [self setNeedsDisplay: YES] to keep 
things going. All drawing is done from inside drawRect which has been invoked 
through the use of [self setNeedsDisplay: YES],

On Aug 15, 2012, at 11:19 PM, Stephen J. Butler wrote:

 On Wed, Aug 15, 2012 at 10:02 PM, Charlie Dickman 3tothe...@comcast.net 
 wrote:
 Here's the whole method... it is being called from within a view's drawRect 
 method...
 
 Are you calling drawRect directly from your code? If so, don't do
 that. You should be sending one of the setNeedsDisplay messages, and
 letting AppKit call drawRect for you.
 
 With AppKit calling drawRect your lockFocus messages should not be needed.

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How do I get memory usage numbers?

2012-08-13 Thread Charlie Dickman
I'm using the system say command to speak phrases within my app. I've tried 
NSSpeechSynthesizer and Carbon's Speech Synthesis Engine but both have a 
serious memory leak problem which gets my app into trouble. By using the system 
say command I move the problem out of my app and into the system.

What I want to do is determine the ratio of inactive to free in order to 
determine when to execute the purge command to free up the inactive memory 
before the system gets into trouble.

On Aug 13, 2012, at 1:56 PM, David Duncan wrote:

 On Aug 12, 2012, at 7:10 PM, Charlie Dickman 3tothe...@comcast.net wrote:
 
 Initially I'm interested in system wide memory usage (free, wired,active, 
 inactive) but following on I might like numbers for just my process.
 If hacking through Darwin is the only way to do this than never mind but 
 with all of the programs out there that include these numbers there must be 
 a better way to find out how it's done.
 
 
 What are you trying to debug?
 --
 David Duncan
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
I'm trying to get the output from a vm_stat command using the following code. 
My app hangs in the [vmRead availableData] call as it should if there is no 
data available but it never comes back. What am I doing wrong? I have searched 
through the sample code on apples developer site with no luck.

NSPipe *vmPipe = [NSPipe pipe];
NSFileHandle *vmRead = [vmPipe fileHandleForReading];

[vm setLaunchPath: @/usr/bin/vm_stat];//  1 page = 4096 
bytes
[vm setStandardOutput: vmPipe];
[vm launch];
NSData *vmData = nil;
int vmDataLength = 0;
do {
vmData = [vmRead availableData];
vmDataLength = [vmData length];
} while (vmDataLength != 0);

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
This is just test code to see if I can actually get the vm_stat data. It is run 
only under the debugger 1 or 2 steps at a time. When I have the concept down I 
will modify it.

No, I actually mean != 0, see below - it is the description of how reading 
available data from a NSFileHandleForReading...

Return Value
 The data currently available through the receiver.
 
 Discussion
 If the receiver is a file, returns the data obtained by reading the 
file from the file pointer to the end of the file. If the receiver is a 
communications channel, reads up to a buffer of data and returns it; if no data 
is available, the method blocks. Returns an empty data object if the end of 
file is reached. Raises NSFileHandleOperationException if attempts to determine 
file-handle type fail or if attempts to read from the file or channel fail.

On Aug 13, 2012, at 6:09 PM, Jens Alfke wrote:

 
 On Aug 13, 2012, at 2:17 PM, Charlie Dickman 3tothe...@comcast.net wrote:
 
  int vmDataLength = 0;
  do {
  vmData = [vmRead availableData];
  vmDataLength = [vmData length];
  } while (vmDataLength != 0);
 
 Don't you mean == 0 on the final line?
 Also, spin-loops like this are a really bad idea — this loop is going to 
 consume something like 100% CPU. If you have to loop like this, run the 
 current run loop in between tests.
 
 —Jens

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
So why doesn't it work???

On Aug 13, 2012, at 7:08 PM, Ken Thomases wrote:

 On Aug 13, 2012, at 5:09 PM, Jens Alfke wrote:
 
 On Aug 13, 2012, at 2:17 PM, Charlie Dickman 3tothe...@comcast.net wrote:
 
 int vmDataLength = 0;
 do {
 vmData = [vmRead availableData];
 vmDataLength = [vmData length];
 } while (vmDataLength != 0);
 
 Don't you mean == 0 on the final line?
 Also, spin-loops like this are a really bad idea — this loop is going to 
 consume something like 100% CPU. If you have to loop like this, run the 
 current run loop in between tests.
 
 This isn't a spin loop and he has the termination condition correct.  
 -[NSFileHandle availableData] blocks if there's no data available.  It 
 returns a zero-length NSData on end-of-file.
 
 Regards,
 Ken
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Using NSPipe to get system command output

2012-08-13 Thread Charlie Dickman
Andy,

THANK YOU SO MUCH!!

I am glad my inquiry spawned some interest but you have taught me how to fish 
;^)

Thanks again

On Aug 13, 2012, at 7:27 PM, Andy Lee wrote:

 Apple seems to have pulled the ancient Moriarity example which demonstrates 
 basic use of NSTask, but my cleanup of it should still work.
 
 https://github.com/aglee/MoreArty
 
 --Andy
 
 On Aug 13, 2012, at 6:42 PM, Kyle Sluder k...@ksluder.com wrote:
 
 On Mon, Aug 13, 2012, at 02:17 PM, Charlie Dickman wrote:
 I'm trying to get the output from a vm_stat command using the following
 code. My app hangs in the [vmRead availableData] call as it should if
 there is no data available but it never comes back. What am I doing
 wrong? I have searched through the sample code on apples developer site
 with no luck.
 
 NSPipe *vmPipe = [NSPipe pipe];
 NSFileHandle *vmRead = [vmPipe fileHandleForReading];
 
 [vm setLaunchPath: @/usr/bin/vm_stat];//  1 page = 4096 
 bytes
 [vm setStandardOutput: vmPipe];
 [vm launch];
 NSData *vmData = nil;
 int vmDataLength = 0;
 do {
 vmData = [vmRead availableData];
 vmDataLength = [vmData length];
 } while (vmDataLength != 0);
 
 
 You can't do this. You need to run the runloop.
 
 --Kyle Sluder
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
 
 This email sent to ag...@mac.com
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


How do I get memory usage numbers?

2012-08-12 Thread Charlie Dickman
How do I get system memory usage numbers within my app?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How do I get memory usage numbers?

2012-08-12 Thread Charlie Dickman
Initially I'm interested in system wide memory usage (free, wired,active, 
inactive) but following on I might like numbers for just my process.
If hacking through Darwin is the only way to do this than never mind but with 
all of the programs out there that include these numbers there must be a better 
way to find out how it's done.

On Aug 12, 2012, at 7:17 PM, Jens Alfke wrote:

 
 On Aug 12, 2012, at 3:21 PM, Charlie Dickman 3tothe...@comcast.net wrote:
 
 How do I get system memory usage numbers within my app?
 
 What kind of memory usage numbers? There are a lot of different ones — take a 
 look at the man page for 'top', or at all the different views in Activity 
 Monitor. And do you want them for all processes or just your own?
 
 (The general answer is to go look up the source to 'top' in the Darwin open 
 source repo and see how it does it. It's using some low-level system calls 
 that I don't believe are documented otherwise.)
 
 —Jens

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: How to...

2012-08-11 Thread Charlie Dickman
WOW!!! Talk about out of the frying pan and into the fire! Running my app using 
the code below to speak phrases hosed my whole system! It wouldn't respond to a 
mouse movement or any keyboard input nor would it reboot properly even from a 
power down/power up restart. I had to reinstall from a saved combined system 
package.

There is a real problem in the speech synthesizer. 

On Aug 9, 2012, at 9:54 PM, Charlie Dickman wrote:

 I have solved my problem as follows; if there is any memory leak inside the 
 speech synthesizer it is isolated to the spawned task and is short lived and 
 outside of my app.
 
   NSTask *ls = [[NSTask alloc] init];
   NSString *thePhrase = [NSString stringWithFormat: @\%@\, 
 phrase];
   NSMutableArray *args = [NSMutableArray arrayWithCapacity: 20];
   [args addObject: thePhrase];
   [ls setLaunchPath: @/usr/bin/say];
   [ls setArguments: args];
   [ls launch];
   [ls waitUntilExit];
   [ls release];
 
 Waiting until the task terminates is absolutely necessary to keep the app 
 from having more than one 'say' task going at the same time which totally 
 garbles the speech and hoses up the system. And the timing between spoken 
 phrases is perfect for my purpose.
 
 On Aug 9, 2012, at 6:05 PM, Charlie Dickman wrote:
 
 I tried the Speech Synthesizer Manager too. It suffers from the same 
 deficiency that NSSpeechSynthesizer does. I suspect that NSSpeechSynthesizer 
 uses the Speech Synthesis Manager internally.
 On Aug 9, 2012, at 2:51 PM, Ken Thomases wrote:
 
 On Aug 9, 2012, at 1:29 PM, Jens Alfke wrote:
 
 On Aug 9, 2012, at 10:00 AM, Charlie Dickman 3tothe...@comcast.net wrote:
 
   NSTask *ls = [[NSTask alloc] init];
   NSFileHandle *stdIn = [NSFileHandle 
 fileHandleForReadingAtPath: txtFilePath];
   [ls setStandardInput: stdIn];
   [ls setLaunchPath: @/usr/bin/say];
   [ls launch];
   [ls release];
 
 My problem is that the command speaks the text in the file when the task 
 is launched but not anything written to it subsequently.
 
 Yeah, when the NSFileHandle hits EOF on the file it will propagate the EOF 
 to the task, which will then exit.
 
 What you want instead is to make your own NSStream that isn't tied to a 
 file. But looking at the NSTask and NSFileHandle APIs, I don't see how you 
 can attach an NSStream to a task...
 
 The correct thing to do is to use a pipe to send data to the task.  You can 
 keep that open as long as you like and keeping writing new data.  However, 
 you (Charlie) also wrote:
 
 I have also looked into using an NSPipe but it doesn't seem to add 
 anything.
 
 You want to look again because that should work.  However, there's no 
 reason to believe that the say command will speak the data in dribs and 
 drabs as you write it.  The man page says that, when input is not a TTY, 
 the text is spoken all at once.  So, presumably it will not speak until you 
 close the pipe and it sees EOF and knows it has all of the data.
 
 If NSSpeechSynthesizer has problems, you might look into the Speech 
 Synthesis Manager.  Either way, I would not expect that you could work 
 around the problems indefinitely using the say command, since it surely 
 uses those APIs under the hood.  (The man page actually states that it uses 
 the Speech Synthesis Manager.)
 
 Regards,
 Ken
 
 
 Charlie Dickman
 3tothe...@comcast.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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net
 
 Charlie Dickman
 3tothe...@comcast.net
 
 
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


How to...

2012-08-09 Thread Charlie Dickman
I am trying to get the unix say command to speak the text I am writing to a 
file using the following...

NSTask *ls = [[NSTask alloc] init];
NSFileHandle *stdIn = [NSFileHandle 
fileHandleForReadingAtPath: txtFilePath];
[ls setStandardInput: stdIn];
[ls setLaunchPath: @/usr/bin/say];
[ls launch];
[ls release];

My problem is that the command speaks the text in the file when the task is 
launched but not anything written to it subsequently. I know about 
NSSpeechSynthesizer and I have tried it but it doesn't work reliably (I think 
the NSSpeechSynthesizer has a memory leak and am in touch with the responsible 
Apple engineer via the speech list but in the meantime...). I have also looked 
into using an NSPipe but it doesn't seem to add anything.
I think what I want to do is execute the command 

ls -f file | say

but I can't figure out how to do that. Can someone help me?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to...

2012-08-09 Thread Charlie Dickman
I tried the Speech Synthesizer Manager too. It suffers from the same deficiency 
that NSSpeechSynthesizer does. I suspect that NSSpeechSynthesizer uses the 
Speech Synthesis Manager internally.
On Aug 9, 2012, at 2:51 PM, Ken Thomases wrote:

 On Aug 9, 2012, at 1:29 PM, Jens Alfke wrote:
 
 On Aug 9, 2012, at 10:00 AM, Charlie Dickman 3tothe...@comcast.net wrote:
 
 NSTask *ls = [[NSTask alloc] init];
 NSFileHandle *stdIn = [NSFileHandle 
 fileHandleForReadingAtPath: txtFilePath];
 [ls setStandardInput: stdIn];
 [ls setLaunchPath: @/usr/bin/say];
 [ls launch];
 [ls release];
 
 My problem is that the command speaks the text in the file when the task is 
 launched but not anything written to it subsequently.
 
 Yeah, when the NSFileHandle hits EOF on the file it will propagate the EOF 
 to the task, which will then exit.
 
 What you want instead is to make your own NSStream that isn't tied to a 
 file. But looking at the NSTask and NSFileHandle APIs, I don't see how you 
 can attach an NSStream to a task...
 
 The correct thing to do is to use a pipe to send data to the task.  You can 
 keep that open as long as you like and keeping writing new data.  However, 
 you (Charlie) also wrote:
 
 I have also looked into using an NSPipe but it doesn't seem to add anything.
 
 You want to look again because that should work.  However, there's no reason 
 to believe that the say command will speak the data in dribs and drabs as 
 you write it.  The man page says that, when input is not a TTY, the text is 
 spoken all at once.  So, presumably it will not speak until you close the 
 pipe and it sees EOF and knows it has all of the data.
 
 If NSSpeechSynthesizer has problems, you might look into the Speech Synthesis 
 Manager.  Either way, I would not expect that you could work around the 
 problems indefinitely using the say command, since it surely uses those 
 APIs under the hood.  (The man page actually states that it uses the Speech 
 Synthesis Manager.)
 
 Regards,
 Ken
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to...

2012-08-09 Thread Charlie Dickman
I have solved my problem as follows; if there is any memory leak inside the 
speech synthesizer it is isolated to the spawned task and is short lived and 
outside of my app.

NSTask *ls = [[NSTask alloc] init];
NSString *thePhrase = [NSString stringWithFormat: @\%@\, 
phrase];
NSMutableArray *args = [NSMutableArray arrayWithCapacity: 20];
[args addObject: thePhrase];
[ls setLaunchPath: @/usr/bin/say];
[ls setArguments: args];
[ls launch];
[ls waitUntilExit];
[ls release];

Waiting until the task terminates is absolutely necessary to keep the app from 
having more than one 'say' task going at the same time which totally garbles 
the speech and hoses up the system. And the timing between spoken phrases is 
perfect for my purpose.

On Aug 9, 2012, at 6:05 PM, Charlie Dickman wrote:

 I tried the Speech Synthesizer Manager too. It suffers from the same 
 deficiency that NSSpeechSynthesizer does. I suspect that NSSpeechSynthesizer 
 uses the Speech Synthesis Manager internally.
 On Aug 9, 2012, at 2:51 PM, Ken Thomases wrote:
 
 On Aug 9, 2012, at 1:29 PM, Jens Alfke wrote:
 
 On Aug 9, 2012, at 10:00 AM, Charlie Dickman 3tothe...@comcast.net wrote:
 
NSTask *ls = [[NSTask alloc] init];
NSFileHandle *stdIn = [NSFileHandle 
 fileHandleForReadingAtPath: txtFilePath];
[ls setStandardInput: stdIn];
[ls setLaunchPath: @/usr/bin/say];
[ls launch];
[ls release];
 
 My problem is that the command speaks the text in the file when the task 
 is launched but not anything written to it subsequently.
 
 Yeah, when the NSFileHandle hits EOF on the file it will propagate the EOF 
 to the task, which will then exit.
 
 What you want instead is to make your own NSStream that isn't tied to a 
 file. But looking at the NSTask and NSFileHandle APIs, I don't see how you 
 can attach an NSStream to a task...
 
 The correct thing to do is to use a pipe to send data to the task.  You can 
 keep that open as long as you like and keeping writing new data.  However, 
 you (Charlie) also wrote:
 
 I have also looked into using an NSPipe but it doesn't seem to add anything.
 
 You want to look again because that should work.  However, there's no reason 
 to believe that the say command will speak the data in dribs and drabs as 
 you write it.  The man page says that, when input is not a TTY, the text is 
 spoken all at once.  So, presumably it will not speak until you close the 
 pipe and it sees EOF and knows it has all of the data.
 
 If NSSpeechSynthesizer has problems, you might look into the Speech 
 Synthesis Manager.  Either way, I would not expect that you could work 
 around the problems indefinitely using the say command, since it surely 
 uses those APIs under the hood.  (The man page actually states that it uses 
 the Speech Synthesis Manager.)
 
 Regards,
 Ken
 
 
 Charlie Dickman
 3tothe...@comcast.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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Power Nap causing NSTimer to fire immediately

2012-08-04 Thread Charlie Dickman
I am not at all sure about the details but I think your app is receiving some 
sort of notification that power sleep is occurring in order to allow it to do 
what it needs to do in that situation. My guess is that all timers are caused 
to expire because when asleep they will not and then, when wake up occurs, the 
app is hung waiting for events that will never happen.

I don't know how, perhaps someone else on this list can respond, but you 
should, when your timers fire prematurely, determine if power sleep is 
occurring and act accordingly.

On Aug 4, 2012, at 11:47 AM, Trygve Inda wrote:

 When our software is running and the Mac goes into Power Nap, our NSTimers
 (which are fire-once and set to 3 hour periods) are firing immediately, so
 the software does the timer work and installed a new fire-once timer for 3
 hours later.
 
 Except that one of course fires immediately and it just keeps going.
 
 How can we prevent this?
 
 I'd like our app to stop completely (but not quit of course) during Power
 Nap.
 
 Just a follow-up. It seems our app shouldn't be able to do anything during
 power nap, but something is causing weirdness. Anyone see anything like this
 with NSTimers on 10.8?
 
 Trygve
 
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Invalidate non-repeating NSTimer after fired?

2012-08-03 Thread Charlie Dickman
You must use the 2nd way. If you don't you could get a memory exception if the 
timer has fired and, therefore, been invalidated.

On Aug 3, 2012, at 4:19 PM, Trygve Inda wrote:

 NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self
 selector:@selector(wantsUpdate:) userInfo:nil repeats:NO]
 
 Sometime after it fires (and occasionally before), I call
 
 if ( myTimer )
 {
   [myTimer invalidate];
   [myTimer release];
   myTimer = nil;
 }
 
 
 Should I really be doing:
 
 if ( myTimer )
 {
if ([myTimer isValid])
 [myTimer invalidate];
 
   [myTimer release];
   myTimer = nil;
 }
 
 
 
 I am doing it the first way without trouble... At least I think it is ok.
 The docs say non-repeating timers are invalidated after they fire.
 
 Which way is better?
 
 Comments?
 
 
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Hang detection

2012-07-29 Thread Charlie Dickman
The way I would do it, even though it may be old fashioned, would be to define 
an int (or NSNumber) in each of the operations that could be involved in the 
hang (race condition) that is assigned a value other than 0 that  uniquely 
represents the operation when it begins and set back to 0 when it ends. Then, 
in the code that is guaranteed to be executed when the hang occurs, check the 
values of the flag values to see which are executing at that point. Indication 
of 2 or more being in execution simultaneously identifies the culprits.
On Jul 29, 2012, at 4:56 PM, John MacMullin wrote:

 My app hangs due to what appears to be two competing operations.  Appears 
 because other possible reasons may exist.
 
 How do I snapshot, debug or otherwise detect and obtain a stack trace of the 
 code causing the hang?
 
 Best regards,
 
 John MacMullin
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: looking for a memory problem

2012-07-17 Thread Charlie Dickman
I've seen this kind of thing before when I have released an object that was 
allocated in the autorelease pool. Have a go over of the objects you release 
and make sure that you own them when you release them.

On Jul 17, 2012, at 6:30 AM, Martin Hewitson wrote:

 Dear list, 
 
 I've been trying to track down a crash that happens sometimes when a document 
 is closed in my NSPersistentDocument based app. This started to appear during 
 the process of going from GC to non-GC. But it only happens after an 
 undetermined number of document closes and reopens. The error message I get 
 in the debugger is 
 
 * thread #1: tid = 0x2103, 0x7fff8f614e90 libobjc.A.dylib`objc_msgSend + 
 16, stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
frame #0: 0x7fff8f614e90 libobjc.A.dylib`objc_msgSend + 16
frame #1: 0x0001098147d0
frame #2: 0x7fff8f61a03c libobjc.A.dylib`(anonymous 
 namespace)::AutoreleasePoolPage::pop(void*) + 434
frame #3: 0x7fff938c8915 CoreFoundation`_CFAutoreleasePoolPop + 37
frame #4: 0x7fff8b8bb6cf Foundation`-[NSAutoreleasePool drain] + 154
frame #5: 0x7fff90146115 AppKit`-[NSApplication run] + 634
frame #6: 0x7fff903c2244 AppKit`NSApplicationMain + 867
frame #7: 0x00011574 TeXnicle`start + 52
 
 
 I've tried disabling various parts of the app trying to isolate where the 
 issue might be. 
 
 Could anyone offer any advice on how I might better track this down? Perhaps 
 using instruments in some way?
 
 Cheers,
 
 Martin
 
 
 
 
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: looking for a memory problem

2012-07-17 Thread Charlie Dickman
What is ARC and where can I read learn about it?

On Jul 17, 2012, at 11:42 AM, Sean McBride wrote:

 On Tue, 17 Jul 2012 12:30:39 +0200, Martin Hewitson said:
 
 This started to appear during the process of going from GC to non-GC.
 
 What do you mean non-GC?  I strongly suggest going from GC to ARC, not from 
 GC back to the stone-age retain-release.  Although quite different 'under the 
 hood', writing for GC and ARC is not so different, and you can even switch 
 over slowly.
 
 -- 
 Sean
 
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: looking for a memory problem

2012-07-17 Thread Charlie Dickman
Never mind. It originates in Xcode 4 and I don't use Xcode 4.

On Jul 17, 2012, at 11:52 AM, Charlie Dickman wrote:

 What is ARC and where can I read learn about it?
 
 On Jul 17, 2012, at 11:42 AM, Sean McBride wrote:
 
 On Tue, 17 Jul 2012 12:30:39 +0200, Martin Hewitson said:
 
 This started to appear during the process of going from GC to non-GC.
 
 What do you mean non-GC?  I strongly suggest going from GC to ARC, not 
 from GC back to the stone-age retain-release.  Although quite different 
 'under the hood', writing for GC and ARC is not so different, and you can 
 even switch over slowly.
 
 -- 
 Sean
 
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net
 
 Charlie Dickman
 3tothe...@comcast.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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Modal event processing

2012-07-06 Thread Charlie Dickman
Actually, no, I'm not trying to mimic user interaction but that's an idea worth 
thinking about.

The program demonstrates how to play Chinese Mah-Jong as described in A.D. 
Millington's (excellent) book The Complete Book of Mah-Jong so it runs on a 
timer driven dispatcher to have each player in turn play his hand.

The problem I am having is that outside events like a click in the menu bar or 
a keyboard event have a hard time getting through.

On Jul 5, 2012, at 11:19 PM, Yingshen Yu wrote:

 Are you trying to mimic user interactions with Cocoa UI? 
 If I understand you right, it might be easier to do it with accessibility 
 API, so you can write a normal Cocoa App and a write another app to mimic 
 user interaction to this cocoa app.
 
 -Jonny
 
 
 在 2012-7-6,上午3:57,Charlie Dickman 3tothe...@comcast.net 写道:
 
 I have a demonstration app that is basically operating on a 0.15 second 
 timer loop. The problem I am having is that even with a periodic timer going 
 off it is very difficult to get menu events and mouse clicks in window 
 controls through to be processed. I have tried setting up an additional flow 
 of events using 
 (NSEvent) + 
 (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds
 
 as well as 
 
 [[NSRunLoop currentRunLoop] runUntilDate: [NSDate 
 dateWithTimeIntervalSinceNow: t != 0. ? t * 1.01 : .01]]
 
 (where t can be set arbitrarily but is typically called with a value of 
 0.15) but none of this improves response. Is there anything else to try?
 
 Charlie Dickman
 3tothe...@comcast.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:
 https://lists.apple.com/mailman/options/cocoa-dev/yingshen.yu%40gmail.com
 
 This email sent to yingshen...@gmail.com

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Modal event processing

2012-07-06 Thread Charlie Dickman
Uli,

Thanks for the education. The way you suggest is what I did pre-OS X and 
Xcode/Cocoa and I didn't have this problem Being self taught (by books, sample 
code and documentation) in programming in Xcode/Cocoa for OS X and IOS it 
sounds like I started off on the wrong foot with the versatility of timers.

I'll have to re-architect the app.

Thanks again.

On Jul 6, 2012, at 7:24 AM, Uli Kusterer wrote:

 On 05.07.2012, at 21:57, Charlie Dickman wrote:
 I have a demonstration app that is basically operating on a 0.15 second 
 timer loop. The problem I am having is that even with a periodic timer going 
 off it is very difficult to get menu events and mouse clicks in window 
 controls through to be processed. I have tried setting up an additional flow 
 of events using 
 (NSEvent) + 
 (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds
 
 as well as 
 
 [[NSRunLoop currentRunLoop] runUntilDate: [NSDate 
 dateWithTimeIntervalSinceNow: t != 0. ? t * 1.01 : .01]]
 
 (where t can be set arbitrarily but is typically called with a value of 
 0.15) but none of this improves response. Is there anything else to try?
 
 It's not how long you give time to the event loop, it is how often. Also, 
 startPeriodicEventsAfterDelay: is intended for mouse tracking, not for 
 general-purpose timers. You're being very vague and fuzzy with your 
 terminology, so I hope you don't mind if I just spell out how I'd do a 
 periodic task, and then you can tell whether that's what you're doing and 
 when you're doing it differently:
 
   - Use an NSTimer to get your periodic processing time, not other calls.
   - Let the rest of the app run normally
   - Do the minimum amount of work needed in your timer. Timers run on 
 your main thread  run loop, so you have to do short bits of work so the OS 
 can come up for breath often enough. E.g. do your pre-loop setup, then put 
 the loop body in the timer (using instance variables for the counter  other 
 stuff you need to keep around between iterations), and then do 1 iteration 
 per timer fire.
   - Don't use blocking calls (like network access) on the main run loop, 
 use calls that do their work on another thread and then call you back when 
 they're done (e.g. NSURLConnection, not NSURL -initWithContentsOfURL:).
 
 Or, if you can run your stuff on a secondary thread, queue up your little 
 bits of work in an NSOperationQueue or other GCD-backed queue that runs on 
 another thread.
 
 Cheers,
 -- Uli Kusterer
 The Witnesses of TeachText are everywhere...
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Modal event processing

2012-07-06 Thread Charlie Dickman
I just had a look at the NSAnimation class document and it actually suggests 
very prominently that, because of the limited capabilities of an NSAnimation, 
an NSTimer be used.

I also just went back over the architecture of my app with Uli's comments in 
mind and have discovered that I think I am actually doing what he suggests. I 
am not polling for events nor am I trying to drive the run loop myself.

In my view's drawRect method I use a global state variable that defines the 
next function to perform. When drawRect gets called I do what is necessary for 
the current state, set up for the next state, set the value for the next state 
and then return from drawRect. So the primary driving force is the periodic 
view update requirement (which is guaranteed by actions invoking [self 
setNeedsDisplay: YES]).

Within the execution of a particular function I use NSTimers to drive the steps 
of that function ultimately exiting back to the dispatch stack in drawRect.

So I am at a loss as how to better allow the system to do a better job of 
servicing menu clicks or keyboard presses.

Can you help me to see what I am missing?


On Jul 6, 2012, at 10:22 AM, Richard Altenburg (Brainchild) wrote:

 In a situation similar to yours, I ended up replacing the NSTimer with an 
 NSAnimation. The animation I was doing was way faster after this tiny change, 
 plus the user interface was not blocked at all. I refresh my animation 30 
 times per second now without any negative effect for the user. I think it is 
 worth a try in your case before you rethink your application.
 
 
 [[[Brainchild alloc] initWithName:@Richard Altenburg] saysBestRegards];
 
 Op 6 jul. 2012, om 15:38 heeft Charlie Dickman het volgende geschreven:
 
 I'll have to re-architect the app.
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Modal event processing

2012-07-05 Thread Charlie Dickman
I have a demonstration app that is basically operating on a 0.15 second timer 
loop. The problem I am having is that even with a periodic timer going off it 
is very difficult to get menu events and mouse clicks in window controls 
through to be processed. I have tried setting up an additional flow of events 
using 
(NSEvent) + 
(void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds

as well as 

[[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 
t != 0. ? t * 1.01 : .01]]

(where t can be set arbitrarily but is typically called with a value of 0.15) 
but none of this improves response. Is there anything else to try?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Modal event processing

2012-07-05 Thread Charlie Dickman
Correct, by your say so, or not if the timers don't drive the program it just 
sits there and does nothing. Human intervention is required to configure it or 
cause it to quit.

On Jul 5, 2012, at 8:24 PM, Graham Cox wrote:

 
 On 06/07/2012, at 5:57 AM, Charlie Dickman wrote:
 
 I have a demonstration app that is basically operating on a 0.15 second 
 timer loop. The problem I am having is that even with a periodic timer going 
 off it is very difficult to get menu events and mouse clicks in window 
 controls through to be processed. I have tried setting up an additional flow 
 of events using 
 (NSEvent) + 
 (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delaySecondswithPeriod:(NSTimeInterval)periodSeconds
 
 as well as 
 
 [[NSRunLoop currentRunLoop] runUntilDate: [NSDate 
 dateWithTimeIntervalSinceNow: t != 0. ? t * 1.01 : .01]]
 
 (where t can be set arbitrarily but is typically called with a value of 
 0.15) but none of this improves response. Is there anything else to try?
 
 
 Well, you could try writing your app correctly, rather than polling and 
 running the event loop manually.
 
 What are you trying to do? Why can't you let the event loop run normally?
 
 
 --Graham

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Transparent NSTextField

2012-06-28 Thread Charlie Dickman
In IB you can set the Draws Background property to no (uncheck the box) or 
send the NSTextField a SetDrawsBackground: NO message.

On Jun 28, 2012, at 11:22 AM, Vincent Habchi wrote:

 Hi everybody,
 
 I’m trying to add a transparent editable NSTextField to a view. As long as 
 the field is not editable (e.g. a label), everything is fine; but with an 
 editable field, I get a background fill. I imagine this is under the window 
 NSTextView responsibility. Has someone already succeeded in programming a 
 totally transparent NSTextField, or shall I recourse to a CATextLayer instead?
 
 Thanks,
 Vincent
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSWindow AutoSave

2012-06-22 Thread Charlie Dickman
I don't know that this is a secret recipe but it works for me when I include 
the following 2 lines of code in the awakeFromNib method of the NSview in the 
window...

   [[self window] setFrameUsingName: @autosaveView];
   [[self window] setFrameAutosaveName: @autosaveView];

And I don't know that it's significant but in the init method for the same 
NSView I declare and initialize the standard defaults.


On Jun 22, 2012, at 12:10 PM, koko wrote:

 I have searched, read and implemented the suggestions found  but in no case 
 can I get a non-resizeable window or panel to open in the last position it 
 occupied.
 
 There must be some secret sauce, is anyone willing to share the recipe?
 
 -koko
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTextField Selection

2012-06-15 Thread Charlie Dickman
You are going around the world to cross the street. Define an NSFormatter for 
your text field and implement a textfield delegate and you can have the exact 
control over the textfield that you are after.

On Jun 15, 2012, at 3:41 PM, Kyle Sluder wrote:

 On Jun 15, 2012, at 12:31 PM, koko k...@highrolls.net wrote:
 
 I have an NSTextField whose width is just enough for M and W.  The filled 
 can get set with text longer than one character. The user is to replace this 
 multi-character text with a single character.
 
 I'm really confused by your description of this interface. How and why can 
 the field be filled with more than one character?
 
 
 So, without having to double click to select all text before entering the 
 single character replacement what is the best way to programmatically select 
 the text?
 
 Actually selecting the text is the easy part. Just call -selectText:.
 
 
 Do I subclass NSTextField , define a tracking rect and look for mouse 
 entered and then -selectText?  Seems extreme. Is there an easy way?
 
 What do you want the trigger to be for selecting all the text? Whenever the 
 user starts editing my text field, all the text should be selected so they 
 can hit one key to replace it all?
 
 If that's what you want, I'd just hook up an object as the text field's 
 delegate and implement -controlTextDidBeginEditing: to select all text in the 
 field editor (accessible via the @NSFieldEditor key of the notification's 
 user info dictionary).
 
 --Kyle Sluder
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Authorization to copy a file -- is it really that complex?

2012-06-14 Thread Charlie Dickman
Laurent,

Thanks so much for the links! For me wrapper packages are by far the best tool 
for understanding Apple's APIs. I used SSCrypto to learn how to use openSSL.

On Jun 14, 2012, at 4:56 PM, Laurent Daudelin wrote:

 Jens,
 
 I understand your pain. I didn't want to go through it either and I finally 
 found BLAuthentication which is a Objective-C wrapper class around the 
 Authorization Services. It's a bit outdated but still works fine for me. It's 
 hard to find a copy somewhere but here is a link:
 
 http://blog.laurent.etiemble.com/index.php?post/2005/12/05/36
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.com
 
 On Jun 14, 2012, at 13:39, Jens Alfke wrote:
 
 I've managed to never have to deal with Authorization Services so far in my 
 Cocoa career; until today. Basically I have an app that needs to install 
 some helper tools that the user can run from a shell. (This is a lot like 
 the way TextMate installs the 'mate' tool.) I'm giving a choice of install 
 locations, but the typical one is going to be /usr/bin, so the app will need 
 to authorize to do that.
 
 Reading through the Authorization Services Programming Guide and 
 BetterAuthorizationSample, this all looks really, really complicated. All I 
 need to do is the GUI equivalent of sudo ditto my_tool /usr/bin — does 
 this really take pages and pages of code involving AuthorizationRefs and 
 IPC, and either setuid or invoking launchctl?!
 
 —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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Data encryption

2012-06-06 Thread Charlie Dickman
Can someone direct me to some documentation on how to do data encryption in 
Cocoa/Objective C/C?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Data encryption

2012-06-06 Thread Charlie Dickman
Thanks Mike. I need to be able to use commoncrypto to do what I need to do. Is 
there a single source with reliable sample code?

On Jun 6, 2012, at 1:02 PM, Mikkel Islay wrote:

 Charles,
 
 Cryptographic services is a good place to start:
 https://developer.apple.com/library/mac/#documentation/Security/Conceptual/Security_Overview/CryptographicServices/CryptographicServices.html#//apple_ref/doc/uid/TP3976-CH3-SW1
 
 Mikkel
 
 On 6 Jun 2012, at 18:51, Charlie Dickman wrote:
 
 Can someone direct me to some documentation on how to do data encryption in 
 Cocoa/Objective C/C?
 
 Charlie Dickman
 3tothe...@comcast.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:
 https://lists.apple.com/mailman/options/cocoa-dev/my.inputstream%40googlemail.com
 
 This email sent to my.inputstr...@googlemail.com
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Data encryption

2012-06-06 Thread Charlie Dickman
Jens,

Thanks for your reply.

I have an application on OS X, not IOS, that contains some sensitive data that 
I want to withhold from those not licensed to use it. I wish to use RSA 
encryption/decryption in block mode (I think). I want to encrypt both the 
public and the private key and I think I want to use (at least) 128 bit 
techniques although 64 bit would probably do.

I intend to store the encrypted information in an NSDictionary as NSData and 
keep it in the application bundle. I plan to re-encrypt the keys after each 
use. I have code that does the archiving but I need the encryption/decryption 
methods. I have tried packages that are available on the internet (AquaPrime, 
SSCrypto) but they are difficult to manage and require a lot of busy work to 
keep up to date.

On Jun 6, 2012, at 1:12 PM, Jens Alfke wrote:

 
 On Jun 6, 2012, at 9:51 AM, Charlie Dickman wrote:
 
 Can someone direct me to some documentation on how to do data encryption in 
 Cocoa/Objective C/C?
 
 That's a pretty broad question! What type of encryption — symmetric or 
 asymmetric (aka public key)? Any particular algorithm? Are you implementing 
 the decryption as well or is that done by an existing implementation? How is 
 the data going to be stored/transmitted and what strength of security do you 
 need?
 
 Maybe it's best if you describe at a high level what you need to accomplish.
 
 I could point you to documentation, but you're not going to like it :/ In 
 general this is in the Security framework, although some stuff is in 
 CommonCrypto. The APIs are complicated, badly designed, and have changed over 
 time; and the documentation is quite inadequate. I have found this to be the 
 single most frustrating area to work on in Mac OS or (especially) iOS, worse 
 even than audio. Be warned: Here Be Dragons.
 
 I do have a framework called MYCrypto* I wrote a few years ago that tries to 
 put a friendly face on this stuff. It's still useable, but in 10.7 Apple 
 decided to suddenly deprecate the standard APIs I was using in favor of newer 
 APIs that I still haven't completely figured out :-p so MYCrypto needs either 
 the 10.6 SDK or deprecation warnings disabled.
 
 Also, if you are going to do anything serious with security (i.e. anything 
 that people other than you are going to rely on), you really need to learn 
 some fundamentals. I highly recommend the book Practical Cryptography by 
 Fergusen  Schneier. It's very easy to get things wrong if you don't know 
 what you're doing, and unlike typical bugs that will be triggered or not by 
 random chance, with security you have very smart and motivated people 
 actively trying to find and exploit your bugs.
 
 —Jens
 
 * https://github.com/snej/MYCrypto

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSTextView selection

2012-06-04 Thread Charlie Dickman
You can use an NSTextView delegate and NSFormatters to adjust the selection as 
it is being made.

On Jun 4, 2012, at 1:10 PM, ecir hana wrote:

 Hello,
 
 I have a NSTextView and when I select all the text, all the lines get
 highlighted from left to right margin, except the last line which is
 highlighted from left margin to the last character on line. Please, is it
 possible to highlight the last line in the same way as the other ones are,
 i.e. to highlight it from left to very right?
 
 I think I need to use setExtraLineFragmentRect:usedRect:textContainer: of
 NSLayoutManager but I'm not sure how to proceed and if it's even the right
 way of doing this.
 
 Thanks in advance,
 
 Ecir Hana
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Memory use

2012-05-28 Thread Charlie Dickman
Is (Are) there functions that report application memory usage, as a whole, on 
the stack, in the autorelease pool, in the heap?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Losing memory

2012-05-27 Thread Charlie Dickman
My application is using (leaking) too much memory and eventually dies because 
no more can be allocated. I have used Instruments to measure the usage and 
leaks and have addressed those it told me about.

Now, however, Instruments indicates that memory reaches a steady state (no more 
increases) yet the app continues to die for lack of memory.

Does anyone know of a next step I can take to help track down this problem?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Dissappearing string

2012-05-16 Thread Charlie Dickman
The actual problem is that I am telling an NSTextfield to set it's contents 
(the method is actually a part of NSCell from which NSTextfield inherits it) 
and it does not appear in the textfield. It used to work but I have no idea 
what I did to break it.

On May 16, 2012, at 12:59 AM, Graham Cox wrote:

 
 On 15/05/2012, at 11:38 AM, Charlie Dickman wrote:
 
 Note that the retainCount has changed in the first case but not in the 
 second.
 Does anyone have any ideas as to what is happening?
 
 
 No, but relying on, peeking at or otherwise taking any notice of retain 
 counts is a sure path to madness.
 
 All you need to do is follow the ownership rules and forget about what the 
 actual retain count is, especially for a complex object like 
 NSAttributedString.
 
 
 WHat is the actual problem you're trying to solve?
 
 --Graham
 
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Dissappearing string

2012-05-16 Thread Charlie Dickman
And a good guess it was because it got me to add the release and = nil to the 
code...

possible[strlen(possible)] = '\0';
NSString *possibleString = [NSString stringWithFormat: @%s, possible];
NSAttributedString *theAttributedString =
   [[NSAttributedString alloc ] initWithString: 
possibleString
attributes: 
theAttributes];
[theSudokuTextField setAttributedStringValue: theAttributedString];
[theAttributedString release];
theAttributedString = nil;

and now it's working again. However, as you can see, theAttributedString itself 
is not mutable.

Thanks millions!

On May 16, 2012, at 1:13 PM, Jens Alfke wrote:

 
 On May 16, 2012, at 9:44 AM, Charlie Dickman wrote:
 
 The actual problem is that I am telling an NSTextfield to set it's contents 
 (the method is actually a part of NSCell from which NSTextfield inherits it)
 
 No; NSTextField inherits that method from NSControl.
 (It _contains_ an NSTextFieldCell, which inherits a method of the same name 
 from NSCell. I know, controls vs. cells is confusing…)
 
 and it does not appear in the textfield. It used to work but I have no idea 
 what I did to break it.
 
 Only thing I can guess is that you passed in a mutable attributed string and 
 later changed its contents. If the control didn’t internally create and store 
 a copy of the original string, this will change the string it contains behind 
 its back.
 
 —Jens

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Dissappearing string

2012-05-16 Thread Charlie Dickman
An excellent observation! That was probably causing all kinds of problems yet 
to be seen!

Thanks so much!

On May 16, 2012, at 1:51 PM, Stephen J. Butler wrote:

 On Wed, May 16, 2012 at 12:39 PM, Charlie Dickman 3tothe...@comcast.net 
 wrote:
possible[strlen(possible)] = '\0';
 
 This can't possibly work. strlen() depends on the string already being
 \0 terminated. You can't use strlen() to find the position to add a
 \0.

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Dissappearing string

2012-05-16 Thread Charlie Dickman
YOU NAILED IT! My formatter is returning an absurd value when presented with 
the string! Now if I can just figure out the regular expression to describe the 
string I'll be in business.

A trillion thanks!

On May 16, 2012, at 6:56 PM, Graham Cox wrote:

 
 On 17/05/2012, at 2:44 AM, Charlie Dickman wrote:
 
 The actual problem is that I am telling an NSTextfield to set it's contents 
 (the method is actually a part of NSCell from which NSTextfield inherits it) 
 and it does not appear in the textfield. It used to work but I have no idea 
 what I did to break it.
 
 
 Does the text field have a formatter? That might be changing its behaviour in 
 all sorts of ways. For example, if a number formatter has a maximum value, 
 your second string numerically has a much higher value than the first, so it 
 might be being rejected by the formatter.
 
 But the mutable vs. immutable suggestion seems more likely.
 
 --Graham
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Dissappearing string

2012-05-15 Thread Charlie Dickman
I can not for the life of me figure this one out.

Here is my code...
PRINT_APPEND(@\n%d, [theAttributedString 
retainCount]);
DESCRIBE(theAttributedString);
TRACE;
[theSudokuTextField setAttributedStringValue: 
theAttributedString];
theAttributedString = [theSudokuTextField 
attributedStringValue];
PRINT_APPEND(@\n%d, [theAttributedString 
retainCount]);
DESCRIBE(theAttributedString);
TRACE;

and this is the console output for an execution that works...

1
theAttributedString (NSConcreteAttributedString) ...
 2 3 4 6 8 { NSFont = \BaskOldFace 9.00 pt. P [] (0x1589f0) fobj=0x46a5e0, 
spc=2.25\;}
-[Controller updatePossibilitiesDisplay:] @ 1133

3
theAttributedString (NSConcreteAttributedString) ...
 2 3 4 6 8 { NSFont = \BaskOldFace 9.00 pt. P [] (0x1589f0) fobj=0x46a5e0, 
spc=2.25\;}
-[Controller updatePossibilitiesDisplay:] @ 1138

and this is the console output for an execution that works...

1
theAttributedString (NSConcreteAttributedString) ...
 1 2 3 4 5 6 7 8 9{ NSFont = \BaskOldFace 9.00 pt. P [] (0x119ce0) 
fobj=0x3e25bc0, spc=2.25\;}
-[Controller updatePossibilitiesDisplay:] @ 1133

1
theAttributedString (NSConcreteAttributedString) ...

-[Controller updatePossibilitiesDisplay:] @ 1138

Note that the retainCount has changed in the first case but not in the second.
Does anyone have any ideas as to what is happening?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Dissappearing textField string value

2012-05-13 Thread Charlie Dickman
Good people,

This one really has me stumped. Perhaps someone can help me out.

In my program is the code...

NSAttributedString *theAttributedString = [[NSAttributedString alloc ]
initWithString: possibleString
attributes: theAttributes];
PRINT_APPEND(@\n%d (%d)...\n%@,
 [theAttributedString retainCount],
 [theAttributedString length],
 theAttributedString);
[theSudokuTextField setAttributedStringValue: theAttributedString];
NSString *s = [theSudokuTextField stringValue];
assert([s length] != 0);

PRINT_APPEND looks like this

#define PRINT_APPEND(format, ...) [self printAppend: [NSString 
stringWithFormat: format, ##__VA_ARGS__]]

printAppend looks like this

- (void) printAppend: (NSString *) theNSString {
printf(%s, [theNSString UTF8String]);
}

This is what appears on the debug console

1 (29)...
 2   
 5   
  7  8   {
NSFont = \BaskOldFace 9.00 pt. P [] (0x3687e20) fobj=0x511bf0, 
spc=2.25\;
}Assertion failed: ([s length] != 0), function -[Controller 
updatePossibilitiesDisplay:], file /Users/Charlie/SudokuX III/Controller.m, 
line 1143.

What could possibly make the stringValue disappear like this?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Basic Question

2012-05-09 Thread Charlie Dickman
As a start change (void) to (IBAction) and have IB re-ingest your .h file with 
the declaration in it.

On May 9, 2012, at 12:33 PM, koko wrote:

 In a subclass of NSView I have implemented:
 
 -(void)print:(id)sender
 
 In IB I have connected a Print  menu item to print: in First Responder.
 
 My print: method is not called.
 
 There is only one instance of print: in the project.
 
 So the basic question is why would my print: method not becalled?
 
 -koko
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: self.myTextField.stringValue = @ fails

2012-05-08 Thread Charlie Dickman
Read the message...

Catchpoint 7 (exception thrown).2012-05-08 18:09:31.742 MyApp[18775:507] 
Invalid parameter not satisfying: aString != nil
On May 8, 2012, at 12:15 PM, Antonio Nunes wrote:

 Catchpoint 7 (exception thrown).2012-05-08 18:09:31.742 MyApp[18775:507] 
 Invalid parameter not satisfying: aString != nil

@ is the nil string and the compiler is smart enough to make the 
substitution. 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Strange issue in stroking a bezier path

2012-05-04 Thread Charlie Dickman
I am having a similar problem but not with an Apple display and at a resolution 
of 1920 x 1080 and not with stroking a path. My problem occurs with textfield 
rendering when the fields abut one another. Sometimes the edges do not line up 
even when they are configured to do so in IB.

(I'm staying in Snow Leopard using Xcode 3; I hate Lion and it's move away from 
the mouse. I suffer from familial tremors and have a tough enough time with the 
mouse and find the gesture pad impossible. I will stay on Snow Leopard until I 
am forced to a new machine. Needless to say I program as a hobby - just for my 
own enjoyment)

At any rate I believe the problem is with the graphics chip and its ability to 
consistently activate pixels in close proximity when not drawn with a single 
stroke. I know of no solution except to adjust the placement of your drawn 
objects to minimize the effect.

Changing monitors or resolution, I think, will not address the problem. A 
different, perhaps better graphics card might.

On May 4, 2012, at 9:19 PM, Peter Teeson wrote:

 Xcode 4.3.2, Lion 10.7.3, 
 Apple 30 Cinema Display, Samsung SyncMaster 950p
 
 Consider the following simple drawRect to demonstrate the issue
 
 - (void)drawRect:(NSRect)dirtyRect
 {
// Drawing code here. 
NSRect bounds = [self bounds];
NSBezierPath *path = [NSBezierPath bezierPathWithRect:bounds];
[path stroke];
 }
 
 In the specific case of the Cinema Display having a resolution setting of 
 1280 x 800
 the rectangle is not fully drawn every time. The top and right edges are 
 missing.
 But sometimes they do draw. It seems quite arbitrary.
 
 I have tested this with all other resolutions on the Cinema Display under 
 both standard
 and HiDPI and also on the Samsung CRT. They all work just fine. Even the 
 Samsung at 1280 x 800.
 
 (I have tried things such as NSIntegralRect but nothing works except to 
 change the resolution)
 
 Why would this occur and only at that resolution and only on the Cinema 
 Display?
 
 Any ideas for tracking it down, or working around it, gratefully received.
 
 TIA and respect….
 
 Peter
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Tracking down SIGABRTs

2012-04-29 Thread Charlie Dickman
It sounds to me like your xib (nib) file has been corrupted. For example, 
it's possible that you have somehow destroyed, say, a link between an object 
(view?) and its counterpart in your implementation or a link between an object 
like a button or a textfield and it's IBAction.

I suggest that you check your xib thoroughly.

On Apr 29, 2012, at 10:50 PM, Alex Zavatone wrote:

 I've had the joy of trying to reassemble my app which a co worker improved 
 last week by moving it to storyboarding.  What's popping up every now and 
 then as I try to wire views together are instant SIGABRTs with no indication 
 why this is happening.
 
 I'm currently stuck going from a TableViewController to another 
 TableViewController and as soon as any TVC loads (even an empty one, even the 
 same one), BLAM.  
 
 The project is based off of the Tabbed Application template, has 4 tabs and 
 all views work fine except one which has a Navigation controller that goes 
 off to a TVC with a Nav bar at the top.  When I try to nav to another TVC, as 
 soon as it finishes displaying, (even with the same or an empty TVC), a 
 SIGABRT happens.  
 
 I've checked the table cell names, rebuilt the screen, checked Apple's 
 samples and Ray W's book, been at this all day, to no avail.  
 
 So, the big question is when a SIGABRT happens, how do each of you go about 
 tracking it down?
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: nstextfield question

2012-04-27 Thread Charlie Dickman
You should have a look at the documentation for NSFormatter. You can define a 
formatter for your text field that gets called when a number of different 
things happen to/in the text field.

You might also want to have a look at the delegate methods available for an 
NSTextField which get called when other things happen to/in the field.

At first you might think that building a formatter for a field that already 
does what you want is redundant but you may find that the advantage of being 
able to get control at virtually all stages of editing is worth it. I certainly 
do.

On Apr 27, 2012, at 12:12 PM, Rick C. wrote:

 Hi,
 
 I might be getting sleepy and overlooking the obvious, but I have a panel 
 with a few text fields and I'm trying to figure out what gets called after 
 entering a value into a text field and while it's still highlighted clicking 
 it again?  In my case when entering a value into one of my text fields (let's 
 say 30) I append a string to that value (let's say Days).  I do this in 
 the action method.  In my subclass in mouseDown I make it where if the value 
 is 30 Days when clicking the text field I will remove the Days so the 
 user can easily edit only the 30 and I append the Days once again in the 
 action method.  My problem is after clicking Enter for that text field if the 
 user would try to edit it again without that text field ever losing focus the 
 Days is not removed because mouseDown doesn't get called.  And I haven't 
 been able to figure out what does get called in this situation?  Thanks,
 
 rc
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: WWDC

2012-04-25 Thread Charlie Dickman
Would you please take this interchange off the air? There is such a thing as 
private email. My inbox is choked with this stuff which is, in my opinion, off 
topic.

On Apr 25, 2012, at 5:56 PM, Wade Tregaskis wrote:

 I filed a bug report under other asking them to increase the numbers of
 attendees at future WWDC.
 
 I thought this for a long time, but then came to the realisation that what's 
 really valuable about WWDC just doesn't scale:  access to Apple engineers.
 
 This wasn't always the case.  The WWDC presentations used to be jealously 
 guarded treasures. Now they're much more readily available.  There's still 
 some benefit to actually attending - you'll be able to access sessions from 
 the conference indefinitely, rather than only for a year or two afterwards - 
 and there are networking aspects and 3rd party events etc.  But I think these 
 pale in comparison to the exclusive utility of Apple engineer access.
 
 I'd even go so far as to say that today, if you're not spending most of your 
 time in the labs or otherwise hunting down people to address specific issues, 
 you're detracting from the common good (in the sense that there's a lot of 
 others out there who missed out on WWDC tickets who would be doing just that, 
 in your place).
 
 Likewise for people that walk into the labs and say things like So I just 
 opened Xcode for the first time - how's it work?.  As an Apple engineer 
 working the labs a couple of years, I have to admit I really dreaded that 
 level of question, on so many levels.  I couldn't fathom how someone could 
 throw down thousands of dollars to attend a conference yet not be enough into 
 development to actually use and know a bit about the tools involved.  
 Treating the developer labs like CS 101 is the most expensive class you'll 
 ever pay for.
 
 Keep in mind that if you sufficiently impress an Apple engineer, whether by 
 being generally clever / entertaining / generous / interesting - all largely 
 functions of the type of problem you go to them with - then some will be 
 willing to give you their direct contact details, and you can follow up with 
 them after the conference.  Maybe even on other issues, and some time later.  
 And they can use that time to really dig into your issue, back in their 
 office, and give you a precise answer you just can't get in a face-to-face 
 meeting.
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Tabbing between text fields

2012-04-18 Thread Charlie Dickman
I have many textfields in an app and I receive the various delegate method 
messages as editing proceeds. I'd like to tab to the next text field when an 
acceptable value has been entered. Is there a way to do this from within one of 
the delegate methods?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Fwd: Fielding a mouseDown in a textField

2012-04-05 Thread Charlie Dickman

Begin forwarded message:

 From: Charlie Dickman 3tothe...@comcast.net
 Date: April 5, 2012 9:28:41 AM EDT
 To: Graham Cox graham@bigpond.com
 Subject: Re: Fielding a mouseDown in a textField
 
 Sorry.
 
 I am writing a Sudoku program and for a standard sudoku puzzle text fields do 
 the job just fine.
 
 I am adding killer sudoku to it and I want to use the same text fields for 
 it. To define the zones I want to use the ability of the text field to draw 
 its background in different colors. When the program enters the mode for the 
 user to enter a puzzle of his/her own I want to use a mouse click in a text 
 field to present the color chooser and determine which field gets the color.
 
 I am able to accomplish this by going into a modal state waiting for a mouse 
 click and then determining which field, if any,  was clicked by comparing the 
 location of the click to each field's frame until I find the appropriate one.
 
 It would be neater if I could field the click in the field directly.
 
 On Apr 5, 2012, at 1:27 AM, Graham Cox wrote:
 
 
 On 05/04/2012, at 9:51 AM, Charlie Dickman wrote:
 
 Good people,
 
 How do I go about fielding a mouseDown event in an NSTextField?
 
 
 
 For what purpose? NSTextField generally works without you having to do 
 anything special. If you have some unusual requirement, you'll need to tell 
 us what it is.
 
 --Graham
 
 
 
 Charlie Dickman
 3tothe...@comcast.net
 
 
 

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Fielding a mouseDown in a textField

2012-04-04 Thread Charlie Dickman
Good people,

How do I go about fielding a mouseDown event in an NSTextField?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


magic trackpad

2011-04-25 Thread Charlie Dickman
I have instrumented a view in my application to respond to trackpad gestures. I 
am programming on a Mac Pro using a magic trackpad for gestures. The program 
gets no messages from gestures made on the trackpad. The mouse responds to 
trackpad finger moves and trackpad clicks.

Is there a way to separate the trackpad messages from the mouse messages? Do 
mouse events have an attribute that distinguishes the trackpad from the mouse? 
What am I missing or can the trackpad only emulate the mouse?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: OS X Desktop

2010-12-07 Thread Charlie Dickman
Thanks Seth. I'll look into AppleScript. Can't you write to the .DS_Store file 
with root privilege?

On Dec 7, 2010, at 1:10 AM, Seth Willits wrote:

 On Dec 6, 2010, at 3:11 PM, Charlie Dickman wrote:
 
 In the days of System 9 there was a thing known as the desktop database and 
 a number of applications/utilities that remembered the location of things 
 on the desktop and would restore a saved configuration on command.
 
 Heh. I made one. Clean Desk was the first program I ever sold. I made like 
 $1200 off of that thing. Pretty nice chunk of change when you're 14. :-)
 
 
 
 For some time now I have been trying to find a similar OS X implementation 
 that actually works. All of the ones I have tried mess up when trying to 
 restore a saved desktop state; some put icons on top of other icons and some 
 place the icons off the screen.
 
 I've tried searching the web for a description of where OS X keeps desktop 
 icon placement information, how to read it and how to save it with no luck.
 
 It really hasn't changed. On OS 9 you had to get the position via 
 AppleScript. It's the same now unless you dig into the private file format of 
 .DS_Store (which I spent a lng time doing for DMG Canvas), but then you 
 can only read the file, not write to it, so you still need to use AppleScript 
 to get/set the file position reliably, unless you're going to force the user 
 to quit Finder, rewrite the private file, and relaunch Finder.
 
 
 --
 Seth Willits
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


OS X Desktop

2010-12-06 Thread Charlie Dickman
In the days of System 9 there was a thing known as the desktop database and a 
number of applications/utilities that remembered the location of things on 
the desktop and would restore a saved configuration on command.

For some time now I have been trying to find a similar OS X implementation that 
actually works. All of the ones I have tried mess up when trying to restore a 
saved desktop state; some put icons on top of other icons and some place the 
icons off the screen.

I've tried searching the web for a description of where OS X keeps desktop icon 
placement information, how to read it and how to save it with no luck.

I was wondering if anyone on this list could help me in my quest.

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: Elapsed time vs sleep

2010-07-26 Thread Charlie Dickman
Try using an NSTimer with a repeating timeout interval of, say, .001 (or 
anything smaller than your required accuracy), and countdown your time delta by 
the same amount each time the NSTimer fires and when you get to zero you'll 
have what you need.

On Jul 26, 2010, at 4:56 AM, Matt Gough wrote:

 I need to calculate (with an accuracy of 0.1 of a second) a real-time time 
 interval. This interval should:
 
 1. Not be affected by whether the system has been put to sleep and woken up 
 while timing. (i.e If I start the timer then sleep the Mac for an hour and 
 wake it up again, my interval should be just over 60 minutes)
 2. Not be affected by changes to the wall clock. (i.e If I start the timer, 
 leave it for an hour and then set the wall clock back to the start time, my 
 interval should be just over 60 minutes and not zero)
 
 Up to now, I have been using mach_absolute_time (which satisfies condition 
 2), but had not noticed that it could not satisfy condition 1. There are 
 several other higher level versions (i.e Uptime, Microseconds), but they all 
 seem to call down to mach_absolute_time.
 
 Obviously all the wall-clock based based (NSDate date], 
 CFAbsoluteTimeGetCurrent) are also out of bounds due to condition 2.
 
 Have I missed something obvious, or is this just not doable?
 
 Thanks
 
 Matt Gough___
 
 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/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: Elapsed time vs sleep

2010-07-26 Thread Charlie Dickman
As long as the NSTimer firing interval is sufficiently small the NSTimer can be 
used. If the run loop is stalled for any significant: time _all_ timers will 
be inaccurate to some degree. The NSTimer works fine for animation and , e.g., 
alarm timers and they are consistent across platforms such as Mac Pros, iMacs, 
iPhones, etc.

On Jul 26, 2010, at 12:12 PM, Kyle Sluder wrote:

 On Jul 26, 2010, at 8:32 AM, Charlie Dickman 3tothe...@comcast.net wrote:
 
 Try using an NSTimer with a repeating timeout interval of, say, .001 (or 
 anything smaller than your required accuracy), and countdown your time delta 
 by the same amount each time the NSTimer fires and when you get to zero 
 you'll have what you need.
 
 NSTimer is not suitable for timekeeping of any significant resolution. 
 NSTimer works by comparing the current time at the top of the runloop with 
 the last time the timer was fired. Obviously, this is highly susceptible to 
 anything that prevents the runloop from running at at least the timer 
 interval—which on a modern multitasking operating system is quite likely.
 
 mach_absolute_time is certainly the way to go. The best advice I've seen out 
 there is to listen for sleep/wake notifications from IOKit and record the 
 system time there to figure out how much time has elapsed between the two.
 
 
 --Kyle Sluder

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: dynamically change circle size held in NSBezierPath

2010-07-25 Thread Charlie Dickman
Use the  transformUsingAffineTransform: to scale your path.

On Jul 25, 2010, at 4:53 PM, Shane wrote:

 When a user decides to display a scatter plot, I iterate through all
 my points and add the x,y points to an NSBezierPath as such with a
 fixed width and height.
 
 - (void) addCoord:(double) xval yCoord:(double) yval
 { 
   NSRect rect = NSMakeRect(xval, yval, 1, 1);
   
   [circlePath appendBezierPathWithOvalInRect:rect];
 }
 
 Then drawRect: gets called which draws my scatter plot coordinates.
 The problem is that, my circles are already drawn to a certain size
 and I need to scale my circles proportionately with my screen size and
 I don't know what size this will be till drawRect: gets called (e.g.
 the user may be resizing the window).
 
   …
 
   NSBezierPath *copyPath = [circlePath copy];
   
   // Move to center of screen.
   NSAffineTransform *xform = [NSAffineTransform transform];
   [xform translateXBy:(bounds.size.width * 0.50)
   yBy:(bounds.size.height * 0.50)];
   
   // Scale proportionately to screen size.
   [xform scaleBy:(xFactor / 2)];
 
   [copyPath transformUsingAffineTransform:xform];
   
   [[NSColor yellowColor] setStroke];
   
   [copyPath stroke];
 
 
 Anyone have suggestions on how to dynamically change my circle size
 for the points which are all held within an NSBezierPath?
 ___
 
 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/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Fast enumeration

2010-07-22 Thread Charlie Dickman
In the past I have used the construct

NSEnumerator *_enumerator = [_array objectEnumerator];
id _id = nil;
while (nil != (_id = [_enumerator nextObject])) {
.
.
.
if (condition)
   break;
}

if (nil == _id) {
.
.
.
}

to determine if the entire contents of _array had been investigated and, if 
not, which object in _array met the condition.

When trying to use, instead,

for (id _id in _array) {
}

how, without reverting to effectively using an enumerator as in

id theID = nil;
for (id _id in _array) {
.
.
.
if (condition) {
   theID = _id;
   break;
}
.
.
.
if (nil != theID) {
.
.
.
}

does one accomplish the same thing?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: Debugger hangs?

2010-07-21 Thread Charlie Dickman
I have turned the data formatters off and the debugger continues to get 
EXC_BAD_ACCESS while stepping through code. It then times out fetching data 
and everything is hosed.

On Jul 21, 2010, at 12:03 PM, Nick Zitzmann wrote:

 
 On Jul 21, 2010, at 4:43 AM, sebi wrote:
 
 every few times I want to step through my code with Xcode's debugger it 
 eventually refuses to work. I click on the Step Over button and then 
 nothing happens. The variable window becomes empty and the three step 
 buttons become greyed out. The Pause button reacts on clicks but doesn't 
 do anything. Stop and restart still work. The Debugger Console doesn't show 
 any output.  It's really annoying when I'm hunting a bug several functions 
 deep and then I have to start all over again because the debugger just stops 
 working. All I can do is to set the breakpoint a bit later, try again and 
 hope for the best.
 Does anyone else experience this behavior? Is there anything I can do?
 
 1. This is a list for Cocoa, not Xcode. Next time, please ask Xcode questions 
 on the Xcode list.
 
 2. That said, this is almost always caused by data formatters. If you turn 
 them off in the Debug menu, the problem should go away.
 
 Nick Zitzmann
 http://www.chronosnet.com/
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


NOAA data feeds

2010-07-20 Thread Charlie Dickman
I apologize if this question is off topic; if it is could someone assist me 
with where I might find an answer.

I'm looking for URL information and, if possible, examples of how to get NOAA 
weather advisory information via wifi into a Cocoa application.

Any help would be gratefully appreciated.


Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: Encrypting data in a Core Data SQL store for a Mac desktop app

2010-07-20 Thread Charlie Dickman
I'm entering this thread late I know and for what it's worth this may be 
inappropriate for what you're trying to do ...

There's an encryption framework available for free from Aquatic Prime 
(http://aquaticmac.com/) that is intended to manage registration keys but 
there's no reason I can see why it couldn't be used to protect data in general. 

I have used it to encrypt data within an app bundle that I don't want to be in 
clear text in the bundle resource (puzzle solutions). When a key is provided 
the app decrypts the data to read it into the program as binary data and use it.

On Jul 18, 2010, at 3:27 PM, Dave Carrigan wrote:

 
 On Jul 18, 2010, at 11:25 AM, Jerry Krinock wrote:
 
 Why does the iPhone information you found not apply to Mac apps?
 
 
 Because iOS 4 offers the Data Protection feature that is not available on Mac 
 OS. 
 
 As far as I know, there is no equivalent for Mac OS. You can try to roll your 
 own encryption, but it's not very easy. Notably, how you handle the 
 encryption key is going to be susceptible to many kinds of attacks. 
 
 -- 
 Dave Carrigan
 d...@rudedog.org
 Seattle, WA, USA
 
 ___
 
 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/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: case-insensitive but case-ordered sort

2010-07-20 Thread Charlie Dickman
You should be able to accomplish what you want using NSPredicate.

You can also use the C functions topper and tolower to detect and distinguish 
case differences.

On Jul 20, 2010, at 1:39 PM, Roland King wrote:

 I want to sort some NSStrings in such a way that words group case 
 insensitively, but within that group lowercase comes first, effectively I 
 want the sort order of letters to be
 
 aAbBcCdDeEfF  .. etc with everything outside the letter space sorting 
 'naturally' and coming after the letters (I actually don't care too much 
 about the last bit honestly they can go where they like as long as it's 
 outside the alphabet range). 
 
 so 
 
 myClass   comes before
 MyClass   which comes before
 yourClass which comes before
 YourClass 
 
 First off is there a defined sort routine in or around NSString which does 
 something like this (I found a kCFCompareForcedOrdering flag in CFString 
 which seems to do something similar, but possibly backwards from what I 
 want). I can restrict the domain to ASCII without any real issues but if 
 there's something which is localized, that would be better. 
 
 I thought perhaps that comparing the two strings case insensitively, 
 returning that compare if they are not equal, but if they are equal, 
 comparing them case sensitively and returning the inverse of that (remember I 
 want a to beat A) would do what I want but I've failed to convince myself 
 that actually works. 
 
 Is there an NSString or CFString method I should be looking at or am I off to 
 roll my own? ___
 
 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/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: There must be a better way

2009-12-25 Thread Charlie Dickman
I am implementing a view to allow the user to select his preferences from 
within the app while it is running instead of having to exit the app to use the 
settings app to do so and then restarting my app.

The preferences view is controlled by the controller I am trying to define. It 
knows how to show the view and acts as both data source and delegate for the 
table view that contains the preference choices.

The trigger to do this is a double tap of the primary view which is handled by 
code in the view.m. So the view needs to tell the controller to obtain the 
prefs. The controller sets the standard user defaults to communicate the users 
choices.

On Dec 23, 2009, at 4:07 PM, David Duncan wrote:

 Is there a reason why your view so tightly bound to it's controller? 
 Typically you define a protocol for any object to respond to and expose a 
 delegate property to define that type of interface. Examples of this are very 
 common in AppKit and UIKit, such as NS/UITableView or UIImagePickerController.
 
 --
 David Duncan @ My iPhone
 
 On Dec 23, 2009, at 2:19 PM, Charlie Dickman 3tothe...@comcast.net wrote:
 
 In an iPod Touch/iPhone app where the view is in 1 xib and it's controller 
 is in a different one, according to the view-controller-data paradigm, is 
 there a better way to link the view to the controller than
 
 [(myView *) [[self view] setController: self]
 
 in the controller where controller has been declared
 
 id controller;
 .
 .
 .
 @property (nonatomic, assign) id controller;
 
 in myView.h with
 
 synthesize controller in myView.m?
 
 Charlie Dickman
 3tothe...@comcast.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/david.duncan%40apple.com
 
 This email sent to david.dun...@apple.com

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: There must be a better way

2009-12-25 Thread Charlie Dickman
Except  the view and the controller are in separate xib's so they can't be 
connected in this way.

On Dec 23, 2009, at 4:08 PM, Seth Willits wrote:

 On Dec 23, 2009, at 11:19 AM, Charlie Dickman wrote:
 
 In an iPod Touch/iPhone app where the view is in 1 xib and it's controller 
 is in a different one, according to the view-controller-data paradigm, is 
 there a better way to link the view to the controller than...
 
 Surely the controller is File's Owner in the view's xib, so just use an 
 outlet on the view and connect it to the controller.
 
 
 --
 Seth Willits
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: [textView:shouldChangeTextInRanges:replacementStrings:] When does this type of event occur?

2009-12-25 Thread Charlie Dickman
If I understand the question what happens is that you receive a mousedown event 
with the modifier key set in the event. It is then up to you how to process a 
modifier-click. Vertical selection is something, I think, you have to do for 
yourself.

Perhaps there's some sample code at Apple's site.

On Dec 23, 2009, at 4:58 PM, Dave DeLong wrote:

 In many apps, you can hold down the option key to change the cursor into a 
 crosshair, and do a vertical selection.  In addition, in apps like Pages, you 
 can hold down the command key to do a non-contiguous selection.  I'd imagine 
 that both of these scenarios might result in that method getting invoked.
 
 Dave
 
 On Dec 23, 2009, at 2:53 PM, Iceberg-Dev wrote:
 
 What kind of event can trigger a non-linear selection to be replaced by 
 multiple strings in different ranges?
 ___
 
 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/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


There must be a better way

2009-12-23 Thread Charlie Dickman
In an iPod Touch/iPhone app where the view is in 1 xib and it's controller is 
in a different one, according to the view-controller-data paradigm, is there a 
better way to link the view to the controller than

[(myView *) [[self view] setController: self]

in the controller where controller has been declared

id controller;
.
.
.
@property (nonatomic, assign) id controller;

in myView.h with

synthesize controller in myView.m?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Linking xib's

2009-12-17 Thread Charlie Dickman
I'm developing an iPhone app that has 2 xib's; 1 for the controller and 1 for 
the main window. This structure is based on that recommended in the Beginning 
iPhone Development book.

When the didReceiveMemoryWarning notification is sent to the controller I want 
to invoke a method in the main view. This means linking an IBOutlet in the 
controller (which has its own xib) to a method defined in the view (which has 
its own xib).

Apparently this CAN NOT be done when the xib's are loaded and must be done in 
the code itself. In OSX this can be accomplished by telling the NSBundle to 
load the necessary nib but simply loading an xib in the iPhone OS doesn't 
resolve the IBOutlet.

Can someone instruct me or direct me to sample code that shows how this is 
accomplished?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: Linking xib's

2009-12-17 Thread Charlie Dickman
OK. From the controller I want to invoke a method in the view.

In the controller I declare an id called myView...

   id myView;

In the Controller's didReceiveMemoryWarning I want to call a method in the 
view thusly...

   [myView cleanMemory];

The question is how does the id myView get the address of myView. When both the 
controller and the view are in the same xib I have IB resolve the myView 
reference by tagging it with an IBOutlet tag so that IB will recognize it and 
then I ctrl-drag the view to the IBOutlet in the controller.

The question is how do I provide this linkage when the controller and the view 
are in _different_ xib's?

On Dec 17, 2009, at 1:02 PM, Quincey Morris wrote:

 On Dec 16, 2009, at 13:20, Charlie Dickman wrote:
 
 When the didReceiveMemoryWarning notification is sent to the controller I 
 want to invoke a method in the main view. This means linking an IBOutlet in 
 the controller (which has its own xib) to a method defined in the view 
 (which has its own xib).
 
 Your question makes no sense because of the fuzziness of linking an IBOutlet 
 ... to a method. IBOutlets point to objects, they don't link to methods, 
 and they're only connected automatically during nib loading (even on MacOS), 
 from the object with the outlet to another object, when:
 
 1. both objects are in the same nib, or
 
 2. the first object is File's Owner and the second object is in the owned nib 
 file.
 
 Apparently this CAN NOT be done when the xib's are loaded and must be done 
 in the code itself. In OSX this can be accomplished by telling the NSBundle 
 to load the necessary nib but simply loading an xib in the iPhone OS doesn't 
 resolve the IBOutlet.
 
 This is also a bit fuzzy, and appears to me to be false (concerning Mac OS X) 
 as it stands. However, I'm not sure I understand what IBOutlet-setting 
 mechanism you're describing.
 
 
 ___
 
 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/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: Linking xib's

2009-12-17 Thread Charlie Dickman
I have discovered the answer. The controller knows about the view without me 
doing any linkage.

It is referenced using [self view] in the controller.

On Dec 17, 2009, at 4:07 PM, Shawn Erickson wrote:

 On Thu, Dec 17, 2009 at 12:46 PM, Charlie Dickman 3tothe...@comcast.net 
 wrote:
 
 The question is how do I provide this linkage when the controller and the 
 view are in _different_ xib's?
 
 Who is the owner (aka loader) of the two xibs? If it is the same
 owning object then just hook up the outlets in the respective xibs as
 needed.
 
 If they don't have the same owner you are going to have to outline a
 little more of the relationships between the objects that load the two
 xibs.
 
 -Shawn

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Sound on iTouch

2009-12-12 Thread Charlie Dickman
Using System Sounds I am able to play sounds successfully in the iTouch 
Simulator but no sound is made when the app executes on my iTouch itself. There 
is a delay when the sound should be playing but no sound is heard.

I have also installed Apple's SysSound sample code on the iTouch and it makes 
no sound either but works fine in the simulator.

Can anyone help me with this?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Re: Core Data Conundrum

2009-12-12 Thread Charlie Dickman
Rick,

This can be done in a straightforward manner using C structures that contain 
pointers to the C structures.

For example, you can define structures

typedef node _node {
segment *someSegment;
}

typedef struct _segment {
node node1;
node node2;
}

set node.segment to nil in the last segment and chain them together. Remember 
to malloc each instance and free them when they are no longer needed.

This model can easily be transmogrified into Objective C objects.

On Dec 12, 2009, at 7:30 PM, Rick Mann wrote:

 Hi. I'm trying to set up a model for a Node and a Segment. A Segment exists 
 between Nodes. Each Segment has a node1 and node2 attribute, and each Node 
 can have multiple Segments. I don't seem to be able to model this 
 relationship; I can have either node1 with an inverse of segments, or node 2, 
 but not both.
 
 It's important for me to distinguish which end of a segment a particular Node 
 is associated with (imagine drawing a directed arrow). I feel like this 
 should be straightforward, but I'm stuck.
 
 Any suggestions?
 
 TIA,
 Rick
 
 ___
 
 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/3tothe4th%40comcast.net
 
 This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


iPhone voice synthesis

2009-12-11 Thread Charlie Dickman
Is there a way to do voice synthesis on the iPhone/iTouch like there is in OS X 
Cocoa using a [NS}voiceSynthesizer?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


.h file won't load

2009-12-10 Thread Charlie Dickman
I'm developing an app that has the Appkit.framework in the Frameworks project 
folder. I am trying to use the NSString Application Kit Additions which 
document that they are defined in the  NSStringDrawing.h file in 
Appkit.framework yet when I #import NSStringDrawing.h or 
Appkit/NSStringDrawing.h the compiler reports that no such file can be found.

Looking in the Appkit/headers folder it definitely is there. What do I have to 
do to get the compiler to recognize it?

Charlie Dickman
3tothe...@comcast.net___

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

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

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

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


String attributes in the iPhone SDK

2009-12-10 Thread Charlie Dickman
I use the following code to determine the height and width of a string in the 
Snow Leopard version of an app

NSMutableDictionary *textAttributes = [[[NSMutableDictionary alloc] 
init] autorelease];
[textAttributes setObject: [NSFont fontWithName: @Garamond Bold size: 
24]
  forKey: 
NSFontAttributeName];
[textAttributes setObject: [NSColor blackColor]
  forKey: 
NSForegroundColorAttributeName];


NSString *text = [NSString stringWithFormat: @%d, h];
NSSize textSize = [faceText sizeWithAttributes: 
faceTextAttributes];

x -= faceTextSize.width / 2.;
y -= faceTextSize.height / 2.;

I'm tearing my hair out trying to figure out how to accomplish the same thing 
in the iPhone SDK. Can anybody help me?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Trying blocks

2009-10-30 Thread Charlie Dickman
I am trying to implement a block in one of my apps. The code looks  
like this...


BOOL (^fillWindow)(void) = ^(void) {
BOOL empty = YES;
int s = 0;
for (NSTextField *theTextField in textFieldArray) {
int textFieldValue = [[theTextField stringValue] 
intValue];
empty = empty  (textFieldValue == 0);
			[thePuzzle replaceObjectAtIndex: s++ withObject: [NSNumber  
numberWithInt: sudokuTextFieldValue]];		

}
return empty;
};
if (!fillWindow()) {...

It compiles fine but the load fails with...

  __NSConcreteGlobalBlock, referenced from:
  ___block_holder_tmp_1.1207 in Controller.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Can anyone explain this and help me with what I'm not doing or not  
doing right?


Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


Breakpoint bubbles

2009-10-30 Thread Charlie Dickman
Breakpoint bubbles have started showing in the midst of my debugging  
window for each breakpoint I have set.


What have I done to cause this and how do I stop it from happening?

Charlie Dickman
3tothe...@comcast.net



___

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

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

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

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


NSView confusion

2008-08-20 Thread Charlie Dickman
Nobody has anything to offer other than a nebulous try changing the  
declarations?


I have tried everything I can think of and have tried the  
documentation I can find and I still can not figure out what is going  
on or what to do about it.


I have an app that contains multiple NSView's which are all visible at  
the same time. They are all sub-classes of NSView but not of any of  
the others. Each has its initialize, initWithRect and drawRect methods  
invoked as it should.


With the exception of the 1st one I defined, the workhorse view, no  
methods implemented in any of the others and declared in the  
respective .h files are visible to any of the other views at compile  
time. I import the appropriate .h files and invoke the method via  
[view method... and the compiler reports that no such method can be  
found. Yet if I invoke the method via [view performSelector:... at  
execution time it works just fine.


I have no idea why the compile time recognition fails. Can someone  
explain to me what is going on and what I can do about it? Should  
there be a view hierarchy? If so, how structured?


Also, how does one synchronize events with the update of the various  
views? I can instruct each view what to draw and it draws it just fine  
(I use lockFocus, etc. when drawing is external to drawRect) and the  
updated view is seen _eventually_ but I can not synchronize subsequent  
activity to happen after the appropriate display is seen. How can I  
accomplish this synchronization? And how can I force a view to update?  
Invoking [view display] has no effect on forcing the display toshow  
the latest update.


Thanks for any help you can provide.

Charlie Dickman
[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: NSView confusion

2008-08-20 Thread Charlie Dickman


On Aug 20, 2008, at 11:08 AM, Joseph Kelly wrote:



On Aug 20, 2008, at 7:25 AM, Charlie Dickman wrote:

I have an app that contains multiple NSView's which are all visible  
at the same time. They are all sub-classes of NSView but not of any  
of the others. Each has its initialize, initWithRect and drawRect  
methods invoked as it should.


With the exception of the 1st one I defined, the workhorse view, no  
methods implemented in any of the others and declared in the  
respective .h files are visible to any of the other views at  
compile time. I import the appropriate .h files and invoke the  
method via [view method... and the compiler reports that no such  
method can be found. Yet if I invoke the method via [view  
performSelector:... at execution time it works just fine.


Sounds like a declaration issue :-)


That may be what it sounds like but I've tried every which way I can  
to declare it differently to no avail.



You get a compile error with:

[view method];

What type is view, and does method contain a typo? Like maybe  
it's mehtod or maybe it requires an argument method:YES? I know  
this sounds pedantic, but we've all banged our heads around really  
dumb errors.


view is an NSView and method is not spelled wrong. As I said, I can  
call it just fine with [view performSelector at run-time.



There are cases where I've got a pointer to a superclass, but I know  
it's really a particular subclass, and I will simply cast the  
pointer to the subclass:


NSView* obj = something;
if ([obj respondsToSelector:@selector(method:withThingy:)])
	[(MyViewClass*) obj method:YES withThingy:something];	// Shut up,  
compiler.


Either way, what you want to do is post a snippet of the offending  
code, including variable declarations.





Also, how does one synchronize events with the update of the  
various views? I can instruct each view what to draw and it draws  
it just fine (I use lockFocus, etc. when drawing is external to  
drawRect) and the updated view is seen _eventually_ but I can not  
synchronize subsequent activity to happen after the appropriate  
display is seen. How can I accomplish this synchronization? And how  
can I force a view to update? Invoking [view display] has no effect  
on forcing the display toshow the latest update.


Calling [view setNeedsDisplay:YES] is the most common way of  
updating. Unless you're writing a 2d game, you'll want to use this  
95% of the time. It flags the view for an asynchronous draw at a  
time when the event loop is idle, and I believe it is syncd up to  
the vbl. If drawing via this method is inefficient -- i.e. there's  
noticeable delay between when you call it and when you draw, this  
means either your drawInRect is using too much cpu, or your main  
thread is using too much cpu. Run Shark.app and see where the time  
is being spent.


If you get your heavy processing out of the way and your drawing  
code is streamlined and it's still taking too long, then you could  
use [view display]; -- this does a synchronous draw + flush, also  
sync'd to the vbl, so it potentially could block your main thread up  
to 0.16 seconds, which is very bad.


See 
https://developer.apple.com/documentation/Performance/Conceptual/Drawing/DrawingPerformance.html

So why are you calling lockFocus?

I call lock focus whenever I'm drawing outside the purview of  
drawRect. This is the way the documentation says to do it.


And I am writing a 2d game and things that need to be clicked on are  
constantly being updated but the display does not match the internal  
game conditions so the appropriate objects can not be selected.




Charlie Dickman
[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: Calling an object from a C function

2008-08-19 Thread Charlie Dickman

What is the syntax? For example, how do I invoke the method

- (int) myMethod: (int) int;

In object myObject

from within a C (not Objective C) function and make use of the result?

In Objective C I would invoke

[myObject myMethod: myInt];

Even better, how do I invoke

- (myObject) myMethod: (myObject *) myObjectArg;

an make use of the result in a C function?

On Aug 19, 2008, at 6:52 PM, David Duncan wrote:


On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote:

I have a C function from which I would like to call a method. I  
can't find any documents the cover how to do this.


You call it just like you call any other method. Your C function  
will need to be compiled with the Obj-C compiler however. Easiest  
way to do this is to name the source file with a .m extension.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to [EMAIL PROTECTED]


Charlie Dickman
[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: Calling an object from a C function

2008-08-19 Thread Charlie Dickman
Thanks to all who responded. I must have had a mental block against  
this.


Now, how do I define things like 'self' and 'super' to a C program?

On Aug 19, 2008, at 7:38 PM, David Duncan wrote:


On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote:

from within a C (not Objective C) function and make use of the  
result?


In Objective C I would invoke

[myObject myMethod: myInt];



You invoke it exactly the same way. There is no difference. But you  
need to compile as Obj-C.


int foo(id bar) { [bar foobaz]; }
--
David Duncan
Apple DTS Animation and Printing



Charlie Dickman
[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]


NSView confusion

2008-08-18 Thread Charlie Dickman
I have tried everything I can think of and have tried the  
documentation I can find and I still can not figure out what is going  
on or what to do about it.


I have an app that contains multiple NSView's which are all visible at  
the same time. They are all sub-classes of NSView but not of any of  
the others. Each has its initialize, initWithRect and drawRect methods  
invoked as it should.


With the exception of the 1st one I defined, the workhorse view, no  
methods implemented in any of the others and declared in the  
respective .h files are visible to any of the other views at compile  
time. I import the appropriate .h files and invoke the method via  
[view method... and the compiler reports that no such method can be  
found. Yet if I invoke the method via [view performSelector:... at  
execution time it works just fine.


I have no idea why the compile time recognition fails. Can someone  
explain to me what is going on and what I can do about it? Should  
there be a view hierarchy? If so, how structured?


Also, how does one synchronize events with the update of the various  
views? I can instruct each view what to draw and it draws it just fine  
(I use lockFocus, etc. when drawing is external to drawRect) and the  
updated view is seen _eventually_ but I can not synchronize subsequent  
activity to happen after the appropriate display is seen. How can I  
accomplish this synchronization? And how can I force a view to update?  
Invoking [view display] has no effect on forcing the display toshow  
the latest update.


Thanks for any help you can provide.
___

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

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

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

This email sent to [EMAIL PROTECTED]


creating a voice

2008-07-26 Thread Charlie Dickman
Can anybody direct me to documentation and or example code that  
explains/shows how to implement a voice for use in OS X?


Charlie Dickman
[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]