Game Center Invite

2014-08-26 Thread Todd Heberlein
I’ve been doing some experiments to invite another player in Game Center on iOS 
devices, and the invite is failing immediately.

I am using the Apple GKMatchmakerViewController to invite the players. If I 
choose “Play Now” on both devices, they eventually find each other. If I do 
“Invite Friend” to invite the other, the invitation immediately fails. I see no 
indicator on the other device that it received the invitation.

Do both devices have to be on the same Wi-Fi network?  My workstation, where I 
am running the simulator, is *not* on Wi-Fi. My Cell phone (the second device) 
is either on Wi-Fi or LTE.

In my authentication handler I basically have

else if ([GKLocalPlayer localPlayer].isAuthenticated) {
[[GKLocalPlayer localPlayer] registerListener:self];
}

And I have the invite handlers (stubs of them):

- (void)player:(GKPlayer *)player didAcceptInvite:(GKInvite *)invite
- (void)player:(GKPlayer *)player didRequestMatchWithRecipients:(NSArray 
*)recipientPlayers

But none of the code is ever called.

I never see a notification, or anything.

Any help as to where I am going wrong would be appreciated.

Thanks,

Todd


___

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

Please do not post 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: Game Center Invite

2014-08-26 Thread Todd Heberlein

> On Aug 26, 2014, at 4:00 PM, Todd Heberlein  wrote:
> 
> Do both devices have to be on the same Wi-Fi network?  My workstation, where 
> I am running the simulator, is *not* on Wi-Fi. My Cell phone (the second 
> device) is either on Wi-Fi or LTE.

If I have two physical devices (an actual iPad and an iPhone) on the same 
Wi-Fi, the invite code works.

If one device is the simulator, the invite code fails.

Grr… I think I ran into this problem a while ago and I just forgot. :(

Todd


___

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

Please do not post 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: NSUserDefaults not sticking

2014-09-10 Thread Todd Heberlein
> in the past few years when it's happened it's been an early symptom of 
> filesystem corruption. Sometimes there have been a bunch of leftover 
> temporary lock(?) files in the Preferences directory.
> 
> If you're getting reports of this from users of your app, it might be worth 
> asking them to run Disk First Aid.

I’ve run into this problem during software development (can’t recall for 
shipping apps). Since it is just during development, I trash the preferences 
file for the app and the problem usually goes away.

(I’m wondering if the file contents became corrupted)

Todd


___

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

Please do not post 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: Changing app screenshots after submission

2014-09-18 Thread Todd Heberlein
> I learned yesterday that you can't change the screenshots in the App Store 
> after your app is approved. Has this always been the case? It seems ludicrous 
> that I have to submit a new binary to change the screenshots (but that's 
> exactly what iTunesConnect support told me).

I don’t know why this is Apple’s policy, but I can speculate on reasons:

(1) Avoid bait-and-switch. During the review process Apple might want to make 
sure the screenshots accurately reflect the actual program. They don’t want 
programmers sliding in unrealistic (or inappropriate) screenshots after a human 
has reviewed it.

(2) Avoid purposely misleading screenshots. I’ve heard stories of programs on 
the Google Play store that have screenshots of popular games for the expressed 
purpose of tricking users into buying the program thinking it was a different 
program (say Minecraft, or a Nintendo game).

(3) Don’t rush to submit a program. Apple may be trying to encourage 
programmers to take the time *before* submitting a program to make sure 
everything is order — descriptions succinct and well written, application icon 
done with care, screenshots well chosen. This cuts down on their work and 
increases approval times for everyone else.

These are just some thoughts.

Apple has a forum for the App Store on their developer web site. That might be 
a better location for a thread such as this. Moderators like to keep this 
mailing list technical in nature.

Todd


___

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

Please do not post 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

completion handlers?

2009-09-06 Thread Todd Heberlein
It seems that the way I previously used an NSSavePanel has been  
deprecated. :(


The new approach seems to use an approach (a function definition  
embedded in the message) that I am not familiar with (I hear ghosts of  
lambda notation whispering into my ear). I assume this is an Objective  
C 2.0 feature, but I am not even sure of the name for this approach.


I would like to look up information on this approach, but I don't even  
know a name for it in order to google it. Could someone give me a  
pointer for pages or keywords?


Thanks,

Todd


[savePanel beginSheetModalForWindow:window completionHandler:^ 
(NSInteger result) {

if (result) {
NSLog(@"Save as: %@", savePanel.URL);
}
}];
___

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

Please do not post 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: completion handlers?

2009-09-06 Thread Todd Heberlein

Thanks for the information.

OK, now a scoping rule question, in the sample code below, does "self"  
refer to my object (i.e., the "self" when the block is declared) or  
the NSSavePanel (i.e., the "self" when the code is executed)?


Todd

[savePanel beginSheetModalForWindow:window completionHandler:^ 
(NSInteger result) {

   if (result) {
   [self someMethod];   //   <-- what "self" should be used?
   }
   }];


___

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

Please do not post 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: authorization services

2009-09-14 Thread Todd Heberlein


On Sep 14, 2009, at 12:57 PM, Mark Thomas wrote:

I was wondering if anybody could tell me if it's correct to use  
authorizationExecuteWithPrivileges and wait() calls together, so the  
parent process wait's until that new child process finishes.  
Googling seems to imply this from the examples I've seen.


This is an indirect answer since I don't know the real one :-/I  
use the BetterAuthorizationSample (BAS) library, and my Cocoa process  
is *not* the parent of the privileged process. I don't think this can  
happen since I think it would break the UNIX model -- a process  
escalating its privilege (other than executing a SUID, SGID file).  
Rather, a launchd process already running as root executes my program  
with the requested privileges and communication from my Cocoa program  
to the privileged process is over a socket.


Using the BAS library, the function call does block until the  
requested remote procedure call finishes (and you get the results from  
the call in the response dictionary). But the privileged process can  
actually live a while longer waiting for subsequent calls. If none  
come after a certain amount of time, then it dies.


Todd

___

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

Please do not post 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


NSNumber bound to NSTextField

2009-09-14 Thread Todd Heberlein
I am trying to understand the behavior of an NSNumber bound to an  
NSTextField. It seems that an NSNumber isn't always and NSNumber.


--
SET UP

I have a class with an NSNumber* bound to an NSTextField via an Object  
Controller

NSNumber*  <---> NSObjectController  <---> NSTextField

Accessors to the NSNumber* are created via
@property (nonatomic, retain) NSNumber* myNum;

The object is initialized as
myNum = [[NSNumber alloc] initWithInt: 5];

--
BEHAVIOR

Then I have an action method to query some aspects of myNum. Before  
changing the number in the NSTextField I get the following:


myNum is NOT a member if NSNumber
myNum IS a kind of NSNumber
myNum responds to intValue
myNum responds to unsignedLongValue


After changing the value in the NSTextField to say 3, I get the  
following results from querying myNum:


myNum is NOT a member if NSNumber
myNum is NOT a kind of NSNumber
myNum responds to intValue
myNum does NOT responds to unsignedLongValue


--
QUESTIONS:
	(1) Why does [myNum isMemberOfClass:[NSNumber class]] return NO when  
I explicitly did an [NSNumber alloc]?


	(2) [myNum isKindOfClass:[NSNumber class]] returns YES, so what type  
of subclasses are there to NSNumber?


	(3) After changing the value in the text field, myNum is neither an  
NSNumber of even a kind of NSNumber. What is it?


	(4) I guess the answer to 3 might explain this, but after the number  
is changed, why does myNum still respond to intValue but *not*  
unsignedLongValue?


--
NOTE:
	By applying an NSNumberFormatter to the NSTextField, the object  
always is "a kind of" NSNumber and always responds to both "intValue"  
and "unsignedLongValue". So I guess the lesson is: If you are going to  
have a GUI NSTextField represent an NSNumber, you should put an  
NSNumberFormatter on it.



Any insights would be appreciated,

Todd

___

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

Please do not post 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: Binding a model's ivar array to the contents of an NSArrayController

2009-09-16 Thread Todd Heberlein
So in short, my need is pretty simple: Bind an array to an  
NSArrayController.  That being said, it seems that no combination of  
exposeBindings:, bind:toObject:withKeypath:options:,  
observeValueForKey:ofObject:change:context:, etc. is working as I  
expect it to.  Admittedly, I have done most of my binding work via  
IB and I've never really done much with  
bind:toObject:withKeypath:options: before, so I wouldn't be  
surprised to find that that was where my problem lay.


Might be a stupid question on my part, but are you using the  
appropriate accessors for your array? For example, if you have


@interface MyDocument : NSDocument
{
NSMutableArray* myStuff;
}

You then need use accessors of the form:

-(NSUInteger)countOfMyStuff;
-(id)objectInMyStuffAtIndex:(NSUInteger)index;
-(void)insertObject:(id)newObj inMyStuffAtIndex:(NSUInteger)index;
-(void)removeObjectFromMyStuffAtIndex:(NSUInteger)index;

Todd

___

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

Please do not post 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: Creator Codes in Snow Leopard

2009-09-23 Thread Todd Heberlein
Some may find the following Apple Insider article on the the topic  
useful:


Inside Snow Leopard's UTI: Apple fixes the Creator Code
http://www.appleinsider.com/articles/09/09/22/inside_snow_leopards_uti_apple_fixes_the_creator_code.html

On Sep 23, 2009, at 9:11 AM, Jens Alfke wrote:


On Sep 23, 2009, at 9:06 AM, Gerriet M. Denkmann wrote:

So I looked at Launch Services Reference, but could not figure out,  
how to inform Lauch Services which app to use for some document.
But if Finder can tell Lauch Services, then my app should be also  
able to do this, shouldn't it?

Where should I look?


My guess is there's some new extended file attribute being used to  
store this. You could use command-line tools ('xattr', I think) to  
inspect the attributes of a file before and after changing its  
default app.




Todd

___

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

Please do not post 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: Creator Codes in Snow Leopard

2009-09-23 Thread Todd Heberlein
As a result, most of their conclusions are incorrect as well.  If  
you can't set the UTI differently on two files with the same type  
code and extension, it can't serve as a creator code.


I've been wondering about this. Daring Fireball carried some links  
with some strong criticisms on this, and I've been waiting for them to  
pick up on AI article, but so far they haven't. I'm just waiting for  
the dust to settle.


Todd

___

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

Please do not post 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


NSTableView Drag & Drop as a string

2009-09-24 Thread Todd Heberlein
I have an NSTableView and I have Drag & Drop working between table  
views for my application where I encode the object to an NSData and  
write it to the NSPasteboard. But now I want to create a string  
representation of the object, add it to the pasteboard as well, and  
then when the object is dragged to something like an email, the string  
representation of the object is written in. The content does seem to  
be written to the pasteboard, but the "drop" doesn't seem to happen in  
an appropriate target (email message, editor, etc.)


The same basic code works in -copy: but it doesn't seem to work in - 
tableView:writeRowsWithIndexes:toPasteboard:


The line of code is:

[pboard setString:str forType:NSStringPboardType];

Is there something different with the NSPasteboard passed into - 
tableView:writeRowsWithIndexes:toPasteboard: versus the pasteboard you  
get from [NSPasteboard generalPasteboard]? Any suggestions on what I  
am doing wrong?


Thanks,

Todd

___

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

Please do not post 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: NSTableView Drag & Drop as a string

2009-09-25 Thread Todd Heberlein

Solved it!

... But now I want to create a string representation of the object,  
add it to the pasteboard as well, and then when the object is  
dragged to something like an email, the string representation of the  
object is written in.


The problem was that I was trying to do a cross-application drag and  
drop. The solution was to add to my -awakeFromNib method the line:


[myTableView setDraggingSourceOperationMask:NSDragOperationEvery  
forLocal:NO];


This allows drag-and-drop across applications.

Todd

___

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

Please do not post 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: Efficient searching of an NSArray of NSDictionary

2009-09-29 Thread Todd Heberlein
 By the way, a quick google search of, "nspredicateeditor example"  
yields a very helpful first result ...


Don't forget, Google yields different results for different people  
based on a variety of factors.


Todd

___

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

Please do not post 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: [iPhone] Application running for the very first time...

2009-09-30 Thread Todd Heberlein
I am wondering if there is a simple way to find out when my  
application is running for the VERY FIRST TIME on an iPhone?

So that I can set an integer variable once only at this moment...

What's the best way to do this?


One approach is to test if a file exists on the file system, and if it  
doesn't:


(1) You know this is the first time the program is running
(2) Then create the file so that future checks will find it

Todd

___

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

Please do not post 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: [iPhone] Application running for the very first time...

2009-10-01 Thread Todd Heberlein
I am wondering if there is a simple way to find out when my  
application is running for the VERY FIRST TIME on an iPhone?

So that I can set an integer variable once only at this moment...

What's the best way to do this?


Also, NSUserDefaults supports this basic capability. I'm just  
wondering if all these defaults for your app are visible from the  
settings application on the iPhone (it is too late and my brain is  
fried); that would screw up this approach.


Todd

___

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

Please do not post 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: Auto Install Login Item

2009-10-03 Thread Todd Heberlein


On Oct 3, 2009, at 12:30 PM, David Blanton wrote:

Should my cocoa app write an entry to com.apple.loginitems.plist so  
it launches at login or is there a better way?


Look at the documentation for launchd.

___

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

Please do not post 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: Probs with "BetterAuthorizationSample"-code

2009-10-03 Thread Todd Heberlein
1.	How can I debug my HelperTool? Obviously any breakpoints set in  
XCode won't work because the HelperTool is launched outside by the  
launchd.
2.	My idea is to use asl to debug "barefoot". But for that I have to  
install aeach time when I have compiled a modified version of the  
HelperTool to the system. But how to do this? InstallerTool does not  
do this itself.


I have used asl_log() messages as a substitute for printf(). The  
messages goes to your Console (the one under /Applications/Utilities)  
and not to the "Console" in Xcode, so make sure you are looking in the  
right place for output.


I think printf() will just cause the HelperTool to exit with error.

Every time I modify any code used by my helper tool I run

$ ./SampleUninstall.sh

I just had to change all the references in the shell script to my  
application's Identifier. For example, my modified shell script has  
the lines:


sudo launchctl unload -w /Library/LaunchDaemons/ 
com.netsq.ACManager.plist

sudo rm /Library/LaunchDaemons/com.netsq.ACManager.plist
sudo rm /Library/PrivilegedHelperTools/com.netsq.ACManager
sudo rm /var/run/com.netsq.ACManager.socket

And the Cocoa app's "Identifier" in the target's property window is:

com.netsq.${PRODUCT_NAME:rfc1034identifier}

(the Project is called ACManager) so "com.netsq.ACManager" is inserted  
in all the appropriate places in the script.


If things are really screwed up, you can look in the directories  
identified in the shell script, remove the appropriate files by hand,  
and then logout and log back in (if that doesn't solve your launchctl  
errors you may need to reboot as a crude but effective step).


But once you have your SampleUninstall.sh script set up correctly,  
running it each time you make code modifications should work.


Todd

___

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

Please do not post 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: Bundle is not using icon or CFBundleIdentifier

2009-10-03 Thread Todd Heberlein

Anyone want to point out what I'm doing wrong?  Any help appreciated.


I think I had to do a Project->Add To Project... and then select the  
icon file in order to get the icon to be used. Dragging the icons into  
my project didn't do the trick.


Todd

___

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

Please do not post 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


Alert prompts for BetterAuthorizationService

2009-10-07 Thread Todd Heberlein
In Apple's BetterAuthorizationSample application pressing the  
"LowNumberedPorts" button brings up a window to authorize yourself. It  
includes the following text to explain why you are authorizing yourself:


"You must be authorized to open low-numbered TCP ports. Type your  
password to allow BetterAuthorizationSample SampleApp to make changes"


The problem is I cannot find where this prompt comes from.

There is the line in the file SampleAuthorizationPrompts.strings
"LowNumberedPortsPrompt" = "You must be authorized to open low- 
numbered TCP ports."


But before even the first build I completely changed the right side to
"LowNumberedPortsPrompt" = "The quick brown fox jumped over the  
lazy dog";


It has no effect on what is displayed in the authorization window.

After the change I have done a find for the phrase that is displayed,  
and it isn't in any of the code in the directory as far as I can tell.  
*Where* is the text being displayed coming from? Please, any help  
would be appreciated.


Todd

___

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

Please do not post 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: Alert prompts for BetterAuthorizationService

2009-10-07 Thread Todd Heberlein


On Oct 7, 2009, at 12:05 PM, Olivier Palliere wrote:

If you already installed your tool once and didn't change the kind  
of rights that it is using, then it is most likely in the /etc/ 
authorization file.


If you remove your rights from there, re-installing your helper will  
recreate the rights with the new value.


Ka-ching!  Thanks a million! I was at my wit's end.

I thought running "SampleUninstall.sh" would take care of things, but  
I was obviously wrong.


Todd

___

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

Please do not post 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: Alert prompts for BetterAuthorizationSample

2009-10-08 Thread Todd Heberlein
I've had trouble with this too, even though my /etc/authorization  
has *my* strings in it.  (I just checked again).   I gave up and  
moved it to my "fix someday" list.  Haven't checked in Snow Leopard  
yet.  Here's my story:


I found the following bug: In my Snow Leopard created project the  
prompt specified in /etc/authorization by BAS  
("BetterAuthorizationSample") is going under the key "English", but if  
I change it to "en" it works fine.


That is, the following, which is put into /etc/authorization by the  
BAS code, does *not* work (note, I've modified the spacing for  
readability):


com.netsq.ACManager.ReadAuditConfig

default-prompt


ReadAuditConfigPrompt
 English
		Reading the system's audit_config file requires an  
administrator password.


rule
default



Whereas the following, in which I just changed "English" to "en" by  
hand, *did* work:


com.netsq.ACManager.ReadAuditConfig

default-prompt


ReadAuditConfigPrompt
 en
		Reading the system's audit_config file requires an  
administrator password.


rule
default



Of course, I can't expect my users to go into /etc/authorization to  
change the entry themselves, and I'm not going to much around with it  
from my code, so I guess I'll wait for Apple to fix this. I'm not even  
sure which code is to blame (the BAS code or the Authorization code).


Todd

___

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

Please do not post 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: Alert prompts for BetterAuthorizationSample

2009-10-08 Thread Todd Heberlein


On Oct 8, 2009, at 4:01 PM, Todd Heberlein wrote:

Of course, I can't expect my users to go into /etc/authorization to  
change the entry themselves, and I'm not going to much around with  
it from my code, so I guess I'll wait for Apple to fix this. I'm not  
even sure which code is to blame (the BAS code or the Authorization  
code).


I found a simple work around.

When the authorization code fails to retrieve the text for the prompt  
in the password request panel that come up, it only displays the  
prompt key, so I simply made the prompt "key" the entire sentence I  
want to display.


For example, in my Common.c code I have

const BASCommandSpec kSampleCommandSet[] = {
{
kACManagerCopyToAuditControlCommand,// commandName
kACManagerCopyToAuditControlRightName,  // rightName
 "default",  // rightDefaultRule
		"To replace the system's audit_config file, you need to authenticae  
yourself.",

NULL// userData
},
...

The "rightDescriptionKey" is that full sentence "To replace ..."  And  
then in the "SampleAuthorizationPrompts.strings" file (no, I didn't  
change the names of the variable or file names from the example code)  
I have the key and the value the same (i.e., the full sentence):


"To replace the system's audit_config file, you need to authenticae  
yourself." = "To replace the system's audit_config file, you need to  
authenticae yourself.";



Now when Snow Leopard doesn't do the right thing and only displays the  
key (and not the value), it's OK because my key is also the value I  
want to display. Now, this wouldn't work if I wanted to do more than  
one language, but it will get me through the current day.


Todd

___

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

Please do not post 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


NSString of selected text in NSTextView

2009-11-07 Thread Todd Heberlein
This seems like a simple task, but it has become a series of steps. Am  
I missing a simple method that will do this?


I have a Text View and want to get the selected text in an NSString  
form. I can get an NSString for the entire NSTextView (-string), but  
to get the string for just the selected text seems to take multiple  
steps:


NSRange range = [theTextView selectedRange];
NSData* rtfData = [theTextView RTFFromRange: range];
	NSAttributedString* aStr = [[NSAttributedString alloc]  
initWithRTFData:rtfData documentAttributes: NULL];

NSString* str = [aStr string];

Is there a method that combines all these steps?

Thanks,

Todd

___

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

Please do not post 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: NSString of selected text in NSTextView

2009-11-08 Thread Todd Heberlein

[[myTextView string] substringWithRange:[myTextView selectedRange];

(Warning, composed in Mail.  Potential thorny issues with text
attachment characters, surrogate pairs, composed characters, marked
text… "the selected text" isn't as simple of a concept as it may
seem.)


Yeah, one of the concerns I had was whether the selected NSRange is  
preserved when -string is called. Thats why I was thinking it might be  
more robust to extract the RTF and then down convert that to a string  
(actually, I may convert it to an C-string) :(.


What I am trying to do is a context sensitive menu, so when a user  
right-clicks in the NSTextView and the selected content looks like an  
IP address, menu items for IP addresses can be presented, and if the  
selected item looks like a file path, menu items for file paths can be  
added. Then of course is the user selects one of those menu items, I'm  
going to need to go through the steps again to extract the content in  
the method.


I just feel this must be a common thing to do (like when menu items  
"Search in Google" and  "Look up in Dictionary" are added to the  
context menu), so I am hoping there is a method that already exists.


Todd

___

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

Please do not post 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: Help needed in Writing network usage monitor application

2009-11-18 Thread Todd Heberlein
> What APIs/library/Technology we should use that notifies us about network
> usages and also provides us with the data being transmitted.
> 
> I have look in libpcap that pretty much gives the packets but i dont know
> how much it helps in notification kind of things.

I don't think there are any Cocoa-specific things that could help, so you may 
want to look at other mailing lists (the moderators try very hard to keep this 
mailing list just for Cocoa questions).

The libpcap library can capture traffic from all your network interfaces, but I 
think you will need to open up a separate tap for each interface. The data will 
be raw packets, pretty much the same thing a network monitor would see, so you 
will have to parse the data. Fortunately most protocols are well documented and 
there are lots of code examples out there, but you may need to handle a lot of 
different cases such as duplicate packets. This would not allow you to map the 
traffic to a specific process, however, and certainly not to a specific element 
thread or sub-object (e.g., the browser window or tab) associated with the 
traffic. This gets even more complicated if you are running virtual machines on 
your system.

If the traffic is encrypted (e.g., encrypted web, encrypted IMAP traffic, SSL 
tunnels, VPNs, etc.), then you are pretty much hosed as far as content analysis 
goes.

Todd

___

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

Please do not post 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: self = [super init], nil?

2010-05-10 Thread Todd Heberlein

On May 10, 2010, at 1:24 PM, David Duncan wrote:

>> By the way, I concur with Thomas Davie: treating a pointer as a Boolean 
>> makes me nervous.
> 
> I don't see any reason not to make the comparison explicit if you desire. I 
> do it all the time :).

This has been part of C since the beginning -- 0 or NULL is false, anything 
else is true. However, I always like to make the comparison explicit to improve 
readability. The only problem is that from time to time I enter a single = 
instead of a double ==, so it does ever so slightly increase the risk of a bug.

Todd

___

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

Please do not post 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: Bypass Network System Preferences for DNS lookup

2010-07-02 Thread Todd Heberlein
> Afaik, no. Why would you do that?

I don't know about the original sender's reason, but DNS servers are often the 
initial target of attacks. Then when you go to, say www.nike.com, the DNS 
server sends you the IP address of a malicious site. That site infects your 
browser, then redirects you to the original www.nike.com web site -- you never 
know you were just hit by a drive-by browser attack.

In any case, this discussion should probably be re-directed to the 
darwin-kernel mailing list instead of Cocoa.

Todd

___

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

Please do not post 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: Submitting Mac App to the App Store

2011-09-10 Thread Todd Heberlein

On Sep 10, 2011, at 1:28 PM, R wrote:

> including the Validating Mac App Store
> Receipts process.

I've removed validating Mac App Store receipts from my code. In general, for at 
least your first release, I would not worry about DRM. If you think your first 
release is going to be so popular that lots of people are going to pirate it, 
that is a good problem to have (think of it as free advertising). In version 
1.1 (or whatever) you can add DRM if you want.

Apple has purposely kept the instructions somewhat vague so all the developers 
don't end up with the exact same solution. Apple wants a diverse set of 
solutions. If we all have the same solution, one "hack" could break all the 
applications.

I think much of the code examples Apple initially provided for Snow Leopard 
have largely been deprecated in Lion because of changes Apple made regarding 
which crypto libraries and APIs they are supporting. I haven't followed this in 
a while though.

Todd

___

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

Please do not post 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


"diskutil info -plist" via Cocoa object?

2011-10-11 Thread Todd Heberlein
I was looking at the rich information provided by diskutil:

$ diskutil info -plist /Volumes/blah

NSWorkspace has some of this information, but I was wondering if there is a 
Cocoa object that provides more of the information provided by diskutil.

If not, does anyone know how is diskutil getting this information? For example 
getfsstat(), statfs(), ...?  I'm having troubles finding the equivalent of 
"BusProtocol" and "Internal" values in these structures.

Todd

___

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

Please do not post 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


New/Update Cocoa Book

2011-11-14 Thread Todd Heberlein
I haven't read it yet, so I can't give you a review. I'm sure many of us have 
at least one of the previous editions, so I thought I'd give everyone a heads 
up.

Cocoa Programming for Mac OS X (4th Edition)
By Aaron Hillegass, Adam Preble
http://www.amazon.com/gp/product/0321774086/

Todd

___

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

Please do not post 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


RaiseMan Exception

2011-12-29 Thread Todd Heberlein
I'm getting an exception thrown that I am trying to figure out.

I'm working through "Cocoa Programming for Mac OS X" fourth edition, and added 
the first undo code in chapter 151 -- the Undo code for adding and removing 
Person objects. Testing seems to work fine, except when I do repeated Undo and 
Redo menu commands very rapidly. At some point when I click on the "Edit" menu 
the program crashes.

For example, I click on "Add Employee" twice, and then repeated go to
Edit --> Undo Add Person
Edit --> Redo Add Person

Crash

The exception is from the default template code:

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError

The frames stack is:
0 __pthread_kill
9 _objc_exception_destructor
10 -[RMDocument dataOfType:error:]  <-- exception 
thrown here
11 -[NSDocument writeToURL:ofType:error:]
39 NSApplicationMain
40 main

Any ideas why I'm getting the exception?

Any idea why [NSDocument writeToURL:ofType:error:] is being called?

Thanks,

Todd

PS. Using
Xcode 4.2 (Build 4D199)
Mac OS 10.7.2
Mac Book Air (MacBookAir3,2)
___

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

Please do not post 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: RaiseMan Exception

2011-12-29 Thread Todd Heberlein
Ah... I figured out an even easier way to repeat the issue.

(1) Run the application.
(2) Add one Person
(3) Click on Mail application to bring it to the front.
(4) wait just a second or two

then crash

The exception is thrown from the same place.

Is this an iCloud thing by any chance?  I haven't added any code to save the 
data yet.

Todd

On Dec 29, 2011, at 12:52 PM, Todd Heberlein wrote:

> I'm getting an exception thrown that I am trying to figure out.
> ...
> The frames stack is:
>   0 __pthread_kill
>   9 _objc_exception_destructor
>   10 -[RMDocument dataOfType:error:]  <-- exception 
> thrown here
>   11 -[NSDocument writeToURL:ofType:error:]
>   39 NSApplicationMain
>   40 main

___

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

Please do not post 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: RaiseMan Exception

2011-12-29 Thread Todd Heberlein

On Dec 29, 2011, at 12:57 PM, Todd Heberlein wrote:

> Ah... I figured out an even easier way to repeat the issue.

Even simpler!  (sorry for all the spam)

(1) Add one Person object
(2) wait 30-60 seconds.

crash.

No clicking on the Edit menu. No clicking away to another application.

Slightly annoyed,

Todd

___

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

Please do not post 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: RaiseMan Exception

2011-12-29 Thread Todd Heberlein

On Dec 29, 2011, at 1:27 PM, Jens Alfke wrote:

> Well, show us some code. (I don't have that book you're working from.)
> What is the line that raises the exception? What are the values of variables 
> at that point?

It is the default code from the Document-based application.  It is the @throw 
exception line

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
/*
 Insert code here to write your document to data of the specified type. If 
outError != NULL, ensure that you create and set an appropriate error when 
returning nil.
You can also choose to override -fileWrapperOfType:error:, 
-writeToURL:ofType:error:, or 
-writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.
*/
NSException *exception = [NSException 
exceptionWithName:@"UnimplementedMethod" reason:[NSString stringWithFormat:@"%@ 
is unimplemented", NSStringFromSelector(_cmd)] userInfo:nil];
@throw exception;
return nil;
}


This seems to be being called by
-[NSDocument writeToURL:ofType:error:]

Except, I'm not doing anything that should prompt the document to be saved. 
Something else is instigating this activity. That is probably what is confusing 
me the most.

Todd

___

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

Please do not post 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: RaiseMan Exception

2011-12-29 Thread Todd Heberlein

On Dec 29, 2011, at 1:50 PM, Conrad Shultz wrote:

> This sounds like Lion auto saving. Are you on Lion? If so, do you return YES 
> from -autosavesInPlace in your NSDocument subclass?

Yes. I just created a new document-based app to test it, and sure enough, the 
template code that is created has

+ (BOOL)autosavesInPlace
{
return YES;
}


Commenting it out seems to have done the trick... I'll bring it back after I 
finish Chapter 10 on archiving.

Thanks everyone!

Todd

___

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

Please do not post 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: Xcode - An Apple Embarrassment

2012-03-01 Thread Todd Heberlein
On Mar 1, 2012, at 3:27 PM, Gene Crucean wrote:

> Man I don't know why there is soo much hate towards v4...

I did find the switch from 3.x to 4.x jarring, but I have adjusted.

I am still using Version 4.1, and for me it has been fairly stable. Are the 
instability issues everyone is complaining about more with versions 4.2 and 4.3?

Todd

___

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

Please do not post 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: text orientation/positioning with layout manager

2011-01-31 Thread Todd Heberlein
On Jan 31, 2011, at 3:23 PM, Aki Inoue wrote:

> The precise definition of the point specified by the argument is the top left 
> corner of the text container containing the glyph range in the focused view 
> coordinate system.

This flipped view for fonts confuses me a bit because the fonts are oriented 
correctly. For example, an 'A' appears upright, not upside down. I'm going to 
have to ponder/research this a little more.

For now, if I want my string drawn on a base line beginning at the point 
basePoint, I currently define a glyphPoint which subtracts the font's pointSize 
from the basePoint's Y value. So far it seems to work on a variety of font 
sizes. Are there any obvious "gotchas" that I am missing with this approach?


Todd

glyphPoint.x = basePoint.x;
glyphPoint.y = basePoint.y - [myFont pointSize];

[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:glyphPoint];

___

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

Please do not post 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: text orientation/positioning with layout manager

2011-02-02 Thread Todd Heberlein
Thanks everyone!  I've learned a lot. I also found working in a flipped view 
easier for just getting a grasp of things like the NSRect returned by 
-usedRectForTextContainer:.

Just for fun, I played with an NSView that is flipped, *except* just before the 
call to -drawGlyphsForGlyphRange:atPoint: (which appears to call -isFlipped), 
then I get upside down text. Silly, I know, but part of the fun of learning how 
things work.

Todd


- (id)initWithFrame:(NSRect)frame
{
...
is_flipped = YES;
...
}


- (BOOL)isFlipped
{
return is_flipped;
}



- (void)drawRect:(NSRect)dirtyRect
{
...
is_flipped = NO;
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:p0];
is_flipped = YES;
...
}

___

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

Please do not post 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


origin: lower left vs lower right

2011-02-02 Thread Todd Heberlein
During the recent text orientation/position thread a couple of things caught my 
attention: (1) the text system seemed designed to have a flipped view (origin 
in the upper left), and (2) the iOS version of an NSView, the UIView, also has 
an origin in the upper left.

If starting some new graphical code for Cocoa (which I may want to port parts 
of to iOS), is it advisable to use a flipped coordinate system (origin in upper 
left)? In other words, is "upper left" the origin of the future?

Thanks,

Todd

___

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

Please do not post 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: origin: lower left vs lower right (lower left vs upper left)

2011-02-02 Thread Todd Heberlein
Bad subject line. My bad.

___

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

Please do not post 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


NSUnicodeStringEncoding

2011-02-11 Thread Todd Heberlein
Looking at the NSString class there is the method

initWithBytes:length:encoding:

I have a unicode string (in C++ object) that I can extract in a number of 
different byte stream formats (UTF-8, UTF-16 (w or w/o BOM)) that I need to 
encode into an NSString. Does the NSUnicodeStringEncoding refer to UTF-8 
encoding?

Thanks,

Todd

___

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

Please do not post 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: NSUnicodeStringEncoding

2011-02-13 Thread Todd Heberlein
On Feb 11, 2011, at 11:10 AM, Kyle Sluder wrote:

> NSUnicodeStringEncoding is an alias for NSUTF16StringEncoding. You're
> best off getting UTF16 from your C++ string and explicitly using the
> NSUTF16StringEncoding constant when creating your NSString. Since
> UTF16 is the canonical representation of strings, this will result in
> the fewest conversions, and using the explicit UTF16 constant rather
> than the equivalent NSUnicodeStringEncoding will make your code
> clearer.
> 
> --Kyle Sluder

Thanks!

[[NSString alloc] initWithBytes:byte_stream length:len 
encoding:NSUTF16LittleEndianStringEncoding]

worked for me.

Todd

___

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

Please do not post 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: Help with Apple Helpbooks

2011-02-23 Thread Todd Heberlein

On Feb 23, 2011, at 4:37 AM, Bruce Cresanta wrote:

> They may be no big deal, but the more I read and try the more confused I get.

I spent most of yesterday on this myself, and I too found it very frustrating. 
Part of my confusion comes from the fact that "Apple Help Programming Guide" is 
a blending of old and new style Help architectures. All examples I found on the 
web were for the old style, not the new one. I have ordered Cheeseman's book 
(it arrives today), and I will post my approach later today or tomorrow.

For what it is worth, here is what I found useful:

(1) Look at examples from the Mail and Terminal applications. These apps are 
using the new style (whereas Safari uses the old style; stay away from that 
one).

(2) You need to edit one Info.plist (the one for your application) and create a 
second Info.plist (the one inside your help bundle/folder). When reading any 
documentation, make sure you know which Info.plist they are referring to.

(2b) In the application's Info.plist you need to identify the Help folder's 
name (key = "CFBundleHelpBookFolder") and the Help Book's name (key = 
"CFBundleHelpBookName"). 

[Another potential source of confusion: if you use the "Property List Editor" 
to edit the Info.plists file, the key's are described with English names. For 
example, the CFHelpBookFolder key is listed as "Help Book directory name", and 
the CFBundleHelpBookName is listed as "Help Book identifier".]

(2c) In your Help Book's Info.plist you need to add a number of things. For 
example, the bundle identifier (key = "CFBundleIdentifier"), and, by the way, 
the Help Book's Info.plist's CFBundleIdentifier and the application's 
Info.plist's CFBundleHelpBookName appear to need to be the same value. For 
example, in the Terminal.app, the value for these keys is 
"com.apple.Terminal.help".

(3) From the Mail & Terminal application examples, it seems that we don't need 
(shouldn't use?) the "AppleTitle" meta tag in the front HTML page anymore 
(despite programming guide saying that it is mandatory).

(4) I'm not sure whether we should have our help folder/bundle name end with 
".help" or not. The Mail and Terminal applications did, but the Apple 
documentation seemed to indicate only Apple apps should do this.



Hopefully I will have a clearer idea by later today.  Good luck.

Todd

___

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

Please do not post 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: Help with Apple Helpbooks

2011-02-23 Thread Todd Heberlein

On Feb 23, 2011, at 9:46 AM, Martin Hewitson wrote:

> I'm not sure if this is the new or the old way, but this worked perfectly for 
> me:

It is the old way, but it is still very useful (and apparently still works). I 
especially liked some of the extra features he adds.

Todd

___

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

Please do not post 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: Book "Cocoa programming for Mac OS X" Third Edition

2011-03-11 Thread Todd Heberlein
I concur: "Cocoa Programming for Mac OS X" (3rd edition) and "Programming in 
Objective-C 2.0" (2nd edition) are the two books I go to the most and recommend 
for people getting started.

Once you've have some experience, then the Apple online documentation is pretty 
good. In particular, when you look at an Objective-C class description, in the 
column on the left there is often a document (or several) that describes the 
broader concepts, how this class relates to others, and provides snippets of 
code showing how to use the class. I often skim these first and then come back 
to the class description. Just make sure you are looking at the documentation 
for the right platform (iOS vs Mac).

I also have numerous other books, including "Cocoa Recipes for Mac OS X" (2nd 
edition). You can never have too many programming books.

One word of warning: the screen shots and detailed description for using Xcode 
and IB will almost always be at least slightly wrong because Apple is 
continuously updating their tools.

Todd



On Mar 11, 2011, at 7:03 AM, Eric Gorr wrote:

> On Mar 11, 2011, at 9:52 AM, David Remacle wrote:
> 
>> I have see on amazon the book "Cocoa programming for Mac OS X" third
>> Edition of Aaron Hillegass. Is this a good book for beginner ?
> 
> Yes! It's the best book for a beginner learning Cocoa.
> 
>> Which books for objective-C 2.0/Cocoa do you recommend for beginner ?
> 
> I might also recommend:
> 
> Programming in Objective-C 2.0 (2nd Edition) [Paperback]
> Stephen G. Kochan (Author)
> • ISBN-10: 0321566157
> • ISBN-13: 978-0321566157

___

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

Please do not post 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


Quartz Debug: UI Resolution

2011-03-16 Thread Todd Heberlein
I am trying to use the Quartz Debug app to scale up my app (for a screenshot 
for MAS). My content looks great in the scaled up windows, but the window 
frames themselves look terrible. For example the title bar and title in it are 
all screwed up.

Is there a setting I can use to make the title bar scale up correctly?

Thanks,

Todd

___

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

Please do not post 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


OCTET_STRING_t -> NSString?

2011-03-29 Thread Todd Heberlein
I'm working my way through Apple's "Validating App Store Receipts", and I can 
extract all the data, compute the digest and compare it against the hash. But 
now I am stuck converting the OCTET_STRING_t for the bundle_id in the Receipt 
to an NSString so I can compare it against my applications Bundle Identifier.

In particular, the beginning of the OCTET_STRING_t's buffer begins with two 
bytes (decimal values 12 and 21). Am I supposed to skip these? For example, the 
following code where I skip these first two bytes seems to work, but it seems 
like a big hack:

OCTET_STRING_t *bundle_id;
...
NSString *string = [[NSString alloc] initWithBytes:(bundle_id->buf + 2)
length:(NSUInteger)(bundle_id->size - 2)
encoding:NSUTF8StringEncoding];

What is the right way?

Thanks,

Todd

PS. Here is the OCTET_STRING_t's buffer for the sample receipt Apple provides. 
One line for each byte. The number is the decimal value for each byte, and the 
corresponding character (if printable) is in the brackets.

 12  [ ]
 21  [ ]
 99  [c]
111  [o]
109  [m]
 46  [.]
101  [e]
120  [x]
 97  [a]
109  [m]
112  [p]
108  [l]
101  [e]
 46  [.]
 83  [S]
 97  [a]
109  [m]
112  [p]
108  [l]
101  [e]
 65  [A]
112  [p]
112  [p]

___

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

Please do not post 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: OCTET_STRING_t -> NSString?

2011-03-29 Thread Todd Heberlein
> In particular, the beginning of the OCTET_STRING_t's buffer begins with two 
> bytes (decimal values 12 and 21). Am I supposed to skip these? For example, 
> the following code where I skip these first two bytes seems to work, but it 
> seems like a big hack:

OK, it seems that the second byte (21 in this case) is the number of characters 
encoded (I haven't tried non-ASCII characters). The OCTET_STRING_t for 
bundle_version begins 12, 5 (where the string resolves to "1.0.2", five 
characters). I still don't know what the 12 means. And does this mean that an 
OCTET_STRING can encode at most 256 bytes?

Any thoughts?

Todd

___

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

Please do not post 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: OCTET_STRING_t -> NSString?

2011-03-29 Thread Todd Heberlein
Ka ching!  Yes, this answer is what I am looking for.  Thanks!!!

Todd

On Mar 29, 2011, at 10:50 AM, Stephen J. Butler wrote:

> On Tue, Mar 29, 2011 at 12:24 PM, Todd Heberlein  
> wrote:
>> In particular, the beginning of the OCTET_STRING_t's buffer begins with two 
>> bytes (decimal values 12 and 21). Am I supposed to skip these? For example, 
>> the following code where I skip these first two bytes seems to work, but it 
>> seems like a big hack:
> 
> I'm not familiar with validating app store bundles, as I'm not
> (currently) a paid developer. But what is this, ANS.1 BER encoding?
> Then the first byte is the tag (the type of data to follow), the
> second byte the length (21), and then the next 21 bytes the data.
> 
> Indeed, Wikipedia (http://en.wikipedia.org/wiki/Basic_Encoding_Rules)
> says that tag 12 is UTF8String. I'd recommend using liblber (man
> lber-decode) if you have to do anything other than basic work with
> this format.

___

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

Please do not post 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: OCTET_STRING_t -> NSString?

2011-03-29 Thread Todd Heberlein

On Mar 29, 2011, at 12:54 PM, Wim Lewis wrote:

> If the security data is in DER, then lber's restricted subset of BER might 
> still suffice. (I haven't looked.)
> 
> But yes, linking openssl and using d2i_ASN1_type_bytes() and either 
> ASN1_STRING_to_UTF8() or mapping the ASN.1 string types to (Core)Foundation 
> string encodings seems like an easy(ish) way to get correct behavior.

I thought my Mac Cocoa program was pretty much done, and that all I needed to 
do was check off a box in Xcode's packaging or Apple's iTunes Connect web site 
saying "I want copy protection".

I didn't realize this was going to be a 2.5 day excursion.

Todd

___

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

Please do not post 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: OCTET_STRING_t -> NSString?

2011-03-29 Thread Todd Heberlein

On Mar 29, 2011, at 1:24 PM, Quincey Morris wrote:

> FWIW, my understanding of the reason it doesn't work that way is this:
> ...

That is pretty much what the Apple documentation says. I felt that they were 
saying, "This is left as an exercise for the reader."  :)

The hacker community has had automated obfuscation tools for years. Some worms 
implement this internally so each new instance is different than the previous 
one. In these cases, instead of avoiding a hacker who wants to break copy 
protection, they want to prevent AntiVirus vendors from coming up with a 
signature to detect the malware.

It seems that a great service to the Mac programming community would be to 
repurpose one of these tools to randomly obfuscate a base receipt validation 
code base and produce source code you can paste into your program. Then each 
person gets a unique version but doesn't have to code it themselves.

Maybe after I get version 1.1 of my software released I will take a look at 
this.

Todd

___

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

Please do not post 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: Mac App Store requirements

2011-04-10 Thread Todd Heberlein

On Apr 10, 2011, at 4:32 PM, davel...@mac.com wrote:

> And you also have add code to verify a valid receipt. There's a few samples 
> of how to do this on github (you should modify them to make the app more 
> difficult to crack unless you're giving the app away for free). Apple has 
> more about this that you can read once you join the developer program.

Validating the receipt is optional.

Having recently gone through this with my first application, I generally would 
not recommend it for version 1.0 of someone's first app (unless it is a very 
expensive app). It is surprisingly complex and poorly documented, and there are 
too many other things to worry about when getting your first app through the 
approval process.

If you want copy protection (which is what receipt validation in about), I 
would leave it until the first update to your application or the second app you 
submit.

Todd

___

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

Please do not post 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


icon radio buttons, NSToolbar?

2011-04-18 Thread Todd Heberlein
I'm trying to get a row of buttons to look and behave like the buttons across 
the Preview app's preference window. It seems like a nicer way to do a tabbed 
view.

Is that just an NSToolbar with custom  graphics/icons, or is that NSMatrix with 
icon radio buttons? Or is it something else entirely?

Thanks,

Todd

___

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

Please do not post 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


NSArrayController & image in column

2011-04-19 Thread Todd Heberlein
I want to have an NSTableView controlled by an NSArrayController using an 
NSArray data source. In one of the columns I want to display one of several 
images. The choice of image will be based on an integer value in one of the 
fields of the array.

What is the best or most recommended way to do this?


Should I add to my NSArray object a field for an NSImage field (with 
getter/setter) and automatically load the image into the NSArray object, and 
then use that the getter for the NSImage as the key in the NSArrayController?

Should I subclass NSTableColumn and override
-dataCellForRow:?

Should I use a delegate for the NSTableView and override
-tableView:dataCellForTableColumn:row:?

Can I even use a custom NSTableColumn or NSTableView delegate with a table 
controlled by an NSArrayController?

Thanks,

Todd

___

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

Please do not post 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: NSArrayController & image in column

2011-04-19 Thread Todd Heberlein

On Apr 19, 2011, at 3:09 PM, Dave DeLong wrote:

> Or just add a method on your data object that vends the appropriate image 
> based on its own properties, and then just bind to that method name as the 
> Model Key Path.  (this is much simpler than the value transformer)

For an experiment I have implemented two columns, one doing it each way. Right 
now I'm just showing a green circle for even numbers and a red circle for odd 
numbers.

Both work, but for some reason the circle images using the transformer don't 
quite look right, like they are duller or something. Maybe a reduced opacity. 
But I am returning a pointer to the same image. Weird.

Any idea why a column with a transformer has duller images?


On a different (but maybe related) note, in MyController +initialize is getting 
called twice even though I have one instance of MyController. This is where I 
register my transformer.

Any idea why +initialize is being called twice?


Thanks,

Todd

___

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

Please do not post 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: NSArrayController & image in column

2011-04-20 Thread Todd Heberlein

On Apr 19, 2011, at 10:08 PM, Quincey Morris wrote:

>> Any idea why a column with a transformer has duller images?
> 
> If it's significantly duller, that probably means it's being shown as 
> disabled.

I figured it out. If the transformer is *not* reversible

+ (BOOL)allowsReverseTransformation { return NO; }

then the image is slightly dimmed. But if the transformer states it is 
reversible

+ (BOOL)allowsReverseTransformation { return YES; }

then the image is fine.


Todd

___

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

Please do not post 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


setting table view's cell size?

2011-04-20 Thread Todd Heberlein
I am able to draw an image in an NSTableView's cell using the NSImageCell, but 
I want a larger cell. What is the best way to do this?

In my first attempt, I subclassed NSImageCell and assign it to the column with 
-setDataCell in -awakeFromNib. I have verified that my custom cell is being 
used, but I still cannot figure out how to use this custom cell to draw a 
larger cell. I tried overriding -cellSize, but it doesn't seem to get called.

Any pointers?

Thanks,

Todd

___

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

Please do not post 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: setting table view's cell size?

2011-04-20 Thread Todd Heberlein
> I am able to draw an image in an NSTableView's cell using the NSImageCell, 
> but I want a larger cell. What is the best way to do this?

OK, I found a solution. I have a delegate for the table that implements

- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row

The documentation says this is "if your table supports varying row heights". Is 
there a better way to do this if all your rows will be the same height?

Todd

___

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

Please do not post 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: setting table view's cell size?

2011-04-21 Thread Todd Heberlein
> Just set the desired row height in IB.
> 
> Programatically, it's -setRowHeight:

Oops!  How embarrassing.  Thanks guys.

Todd

___

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

Please do not post 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


Window fringe, automatic guides

2011-04-27 Thread Todd Heberlein
The HIG talks about the removal of window-frame surface on the sides of windows 
starting in Mac OS X 10.5. But when using IB (I'm still back in 3.2.6) some 
objects show an automatic guide when positioning near the edge of a window 
(e.g., NSView (custom view), NSSplitView, NSPopupButton, NSTextview, NSBox) 
while others do not (e.g., NSTabView, NSScrollView (with NSTableView or 
NSTextView inside).

Should I be interpreting the presence or lack of a guide at a Window's edge 
when placing an object in IB to mean anything?

For example, is it OK to place an NSBox all the way to the window's edge but 
not an NSTabView?

Thanks,

Todd

___

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

Please do not post 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


Layout vs. Frame: X position of objects

2011-04-27 Thread Todd Heberlein
When using the "Size & Position" information for an object to position it in a 
view, what is the difference between the "Layout" and "Frame" values in the 
pop-up button?  When should I use "Layout", and when should I use "Frame"?

When trying to layout objects, especially when trying to align them with the 
edge of a window, should I be using "Layout" when setting the X position and 
width?

Thanks,

Todd

--- Experiment ---

I took 5 objects in IB (3.2.6) and put them on a window, selected them all, and 
chose

Layout -> Alignment -> Align Left Edges

Visually they all looked aligned, but when I checked the X position of these 
objects under "Size & Position", I got a range of values for the "Frame" (see 
below) but a consistent value of 100 for "Layout".

100 NSScrollView (with NSTableView)
100 NSView (custom view)
97  NSBox
94  NSButton
93  NSTabView

___

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

Please do not post 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: Seeding random() randomly

2011-05-27 Thread Todd Heberlein
Regarding format specifiers, there is the "String Format Specifiers" section of 
the "String Programming Guide" in Apple's Developer Documentation. Here is a 
link to the web version:

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html%23//apple_ref/doc/uid/TP40004265-SW1

Todd

___

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

Please do not post 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


Cocoa-preferred licensing key style?

2011-05-29 Thread Todd Heberlein
For Cocoa apps not distributed through the Mac App Store, is there a 
common/recommended design pattern for license keys?

A little googling around I found common locations were:
/Library/Application Support/YourApp/
/Library/Preferences/YourAppBundleID.plist

I'm leaning towards a plist file in /Library/Preferences. Is this a good idea?

Are there any standard Cocoa classes/frameworks that are helpful for using 
license keys?

Thanks,

Todd

___

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

Please do not post 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: Cocoa-preferred licensing key style?

2011-05-31 Thread Todd Heberlein
Thanks everyone!  This has definitely helped.

Todd

___

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

Please do not post 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: Does anyone else dislike Xcode 4?

2011-07-24 Thread Todd Heberlein
On Jul 24, 2011, at 10:57 AM, Julie Seif wrote:

> I really do not like Xcode 4. I feel like I'm a beginner all over again in
> Xcode 4... I was just so comfortable to the Xcode 3 and previous releases of
> Xcode interface.

I've been a light user of the development environment since NeXTStep 2.1, and I 
feel this is the most radical change I've experienced. It set my development 
efforts back a couple of weeks as I fixed things that had broken, figure out 
how to do things again, find where the build products were placed, and so on. 
It was at times very frustrating.

But give it a few weeks. Play with it a lot, especially on experimental 
projects and workspaces (not a production code base), and generally explore. I 
found it grew on me after a while.

I look forward to some in-depth books (or e-books) on working with and getting 
the most out of Xcode 4.x.

Todd

___

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

Please do not post 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: Finding process path from Cocoa?

2009-12-09 Thread Todd Heberlein

On Dec 9, 2009, at 4:23 AM, Alastair Houghton wrote:

> Specifically, a potential attacker will deliberately not follow this 
> convention.  The Security Server used to get the information for the program 
> name in this manner, which created quite an interesting vulnerability since 
> you could get it to display an authorisation dialog with *any* name you 
> wanted in it.  I blogged about that particular security hole some time ago:

Drifting far afield from Cocoa... but it seems that there isn't a good Cocoa 
solution for this. Snow Leopard has a very good audit trail system with a live 
audit stream /dev/auditpipe. With a little work, this could potentially be used 
to map process IDs to the disk image they are running.

Todd

___

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

Please do not post 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


Menu items unexpectedly disabled

2009-12-18 Thread Todd Heberlein
I have a document-based app. For each document there can be a couple of 
satellite windows brought up for specific views of some of the data. Each of 
these satellite windows is controlled by an NSWindowController subclass loaded 
by MyDocument and added via addWindowController:.  A menu item's target is the 
First Responder, and the method to implement the action is in MyDocument. 
Everything works as expected when the primary window is key.

The problem is that when one of the satellite windows is key, menu items 
implemented by MyDocument are disabled. I thought the responder chain went 
through the NSWindowController and then through to its NSDocument? Or is this 
only the case when for the document's primary window (and NSWindowController)?

Note: The work around is trivial. I just implemented the method name in the 
satellite window's NSWindowController subclass and forwarded the call to the 
document:

-(IBAction) doMenuThing: (id)sender
{
[[self document] doMenuThing: sender];
}

but I feel this isn't the "Cocoa Way" of doing it. Am I missing a configuration 
step?

Todd

___

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

Please do not post 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: Menu items unexpectedly disabled

2009-12-18 Thread Todd Heberlein
> That's correct, and that's how it should work. It works here in a test app. 
> Are you doing anything "unusual" in your NSWindowController? What methods are 
> you overriding?

My bad. After getting your email I kept dug around a bit more, and I discovered 
I had not connected the NSWindowController subclasses' "window" outlets to the 
NIB's windows. Once I did that, everything started working.

Thanks,

Todd

___

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

Please do not post 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 Binary Strings

2009-12-30 Thread Todd Heberlein

On Dec 30, 2009, at 9:17 AM, Mr. Gecko wrote:

> Is it possible for me to encrypt the strings in my binary so hackers can't 
> easily figure out what my application has in it? Reason I'm asking is I have 
> some private keys that encodes data that I/parents don't want kids or 
> teenagers to find.

Have you tried the OpenSSL crypto library? Maybe you could could encrypt your 
data, and then use an algorithm to put together the key at runtime. It isn't 
super secure, but he will prevent the data from sitting there on the disk in 
plaintext.

Another thing to look at is DRM techniques. They need to solve a similar 
problem.

Todd

___

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

Please do not post 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: drawatpoint

2010-01-02 Thread Todd Heberlein
> I'm fairly new to programming for the iPhone (still getting up to speed!),
...
> but I can't figure out from the docs, nor from online code examples, how to 
> do this. 

I liked the book "Beginning iPhone 3 Development: Exploring the iPhone SDK". It 
is a good way to get up to speed on iPhone development. I think it would have 
answered your question too.

Todd

___

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

Please do not post 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


Resolution Independence

2010-01-05 Thread Todd Heberlein
A friend of mine loves her new 27" iMac but has complained at how small 
everything is. Searching around on the net I found that it has about a 109 dpi 
pixel density. I also saw today that the new Nexus phone has a pixel size of 
800x480 (as opposed to my iPhone's 480x320 pixel size), and the two together 
got me thinking more seriously about resolution independence again. Other than 
making big icons for my apps, I had pretty much ignored the resolution 
independence issue.

Today I fired up Quartz Debug to set the UI Resolution to a bigger scale, and I 
am happy that my applications did OK.


But how accurate of a test is this compared to real-world resolution 
independence?

Or in other words, is there real resolution independence built into Snow 
Leopard for apps? Can I (or my friend with her 27" iMac) set a scale factor on 
an application without using Quartz Debug?

Is there something similar for iPhone development?

Or is the Xcode mailing list a better place for this question?

Thanks,

Todd

___

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

Please do not post 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: Allow only root/admin users to execute the cocoa app

2010-01-24 Thread Todd Heberlein
> I want to allow my cocoa app to be only launched by root/admin users.
> How can i achieve this?

As I think has already been mentioned, the UNIX approach is to set the 
application's owner as root and then make it only executable by the owner. 
However, Apple largely discourages programmers from developing Cocoa apps that 
will be run with root privileges.

A better approach, if possible, is to factor out the section of code that needs 
to be run with root privilege (e.g., to read a protected file or open a network 
tap) and place that in a command line helper tool. The Cocoa app then runs with 
normal privileges. When the program needs to perform the privileged operation 
it calls that helper app (think of it as a kind of remote procedure call).

Look up Apple's BetterAuthorizationSample code for how to do this.

Todd

___

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

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

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

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


Re: How to resume an XCode Download

2010-02-10 Thread Todd Heberlein
My problem is that my ISPs use long-haul WiFi links that seem to go down fairly 
regularly (which is why I keep redundant ISPs). This make multi-hour downloads 
occasionally frustrating.

Todd

On Feb 10, 2010, at 9:00 AM, Philip Ershler wrote:

> 
> On Feb 10, 2010, at 9:45 AM, Richard Somers wrote:
> 
>> On Feb 10, 2010, at 2:28 AM, Tharindu Madushanka wrote:
>> 
>>> Is there any way I could resume a broken XCode download due to session 
>>> expire..
>> 
>> I also have a slow connection. I have never been able to resume a broken 
>> XCode download. The only solution I have found is making sure your computer 
>> stays awake during the entire download.
>> 
>> --Richard
>> 
> 
> I don't know why this is such a mystery. Just go to the Energy Save panel in 
> System Preferences and set the computer  to never sleep. You can set the 
> screen to sleep if you wish.

___

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

Please do not post 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: Several Questions

2009-05-30 Thread Todd Heberlein
Sorry about the confusion, yes I meant it will run normally but  
unattended.
I need to make sure it recovers from any errors. in the worst case  
if it
crashes, I need it to launch again automatically, even if there's 1  
minute

or whatever delay, it's absolutely fine.


So it is a GUI app that will run unattended, but someone will be  
logged in at the console?


One approach is to have a very simple, bullet-proof UNIX program that  
launches the GUI app (via fork()/exec()) and then calls wait() or wait4 
(), which should block until the GUI application dies or quits. Then,  
when wait() returns indicating the GUI program has exited you could  
check to see if you want to relaunch it again or not.


You could also write a small daemon to be started by launchd at  
regular intervals (say once a minute, or whatever your threshold is)  
to look to see if the other program is running, and if it isn't, start  
it again.


Todd


___

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

Please do not post 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: Several Questions

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


So if in your launchd module you have the key-value pair:

KeepAlive


will launchd automatically restart the program when it exists no  
matter what the exit status is? I wasn't a 100% sure.


Todd

___

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

Please do not post 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: Several Questions

2009-06-01 Thread Todd Heberlein

why should your app stops responding?

Do you want to detect time-outs (network-times, IO-timeouts, ...) or  
will your app be crap and full with bugs?


I wish my code never had infinite loops (Apple's address:) or  
multithreaded deadlocks or other types of bugs... but sometimes sh*t  
happens. I'm not sure how launchd would reliably detect all the  
potential variations however. I liked someone else's suggested  
solution -- periodically send your application something it should  
respond to, or maybe have it generate some type of heartbeat (e.g.,  
send a message to another application, append data to a file, or  
update the timestamp on a file).


Todd

___

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

Please do not post 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: Several Questions

2009-06-01 Thread Todd Heberlein
FYI: I was looking through some Darwin mailing lists archives, and I  
ran across this posting about launchd at WWDC that may be of interest  
to this thread:



Hello all,

If you're attending WWDC and are interested in the BSD-level  
technologies in Mac OS X, I'm giving a talk on launchd this year. It's  
session 500, "Managing Processes with launchd", and several of us from  
the BSD team will be available for Q&A afterward. We'll all be happy  
to answer your questions.


Hope to see you there!
--
Damien Sorresso
BSD Engineering
Apple Inc.

___

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

Please do not post 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: Several Questions

2009-06-01 Thread Todd Heberlein


Great, so I understand from what you're saying that I can launch a  
GUI app

using launchd?


Out of curiosity, I just tried this. I created a basic Cocoa app (I  
made no changes to it, I just built the default skeleton application  
that Xcode creates for you). The project is in the directory:

/Users/heberlei/Development/Tests/BasicApp/
and the full path to the program is
	/Users/heberlei/Development/Tests/BasicApp/build/Debug/Basic.app/ 
Contents/MacOS/BasicApp


I then created a launchd XML file called app_shouldnt_die.plist and  
put it in the directory


/Library/LaunchAgents

(I also set it to be owned by root:wheel, don't know if that matters).

Now when I log in, that BasicApp starts up. If I quit the app, it  
starts again (usually within ~5 seconds). If I do the "kill "  
command from the command line, the application starts again.


Also, when I login as a completely different user, the application  
still starts up automatically. So no matter who logs in, they have to  
live with this darn app alway on.  Pretty cool (or maybe just  
irritating :).


The content of app_shouldnt_die.plist that directs launchd to always  
keep the program running is:



http://www.apple.com/DTDs/PropertyList-1.0.dtd 
">



Label
com.netsq.app_shouldnt_die
Program
	/Users/heberlei/Development/Tests/BasicApp/build/Debug/ 
BasicApp.app/Contents/MacOS/BasicApp

KeepAlive





Todd


___

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

Please do not post 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: launchd detecting when an application is running

2009-06-04 Thread Todd Heberlein
I have written an application that I would like to launch whenever a  
certain app is launched.  I have used LaunchAgents in the past to  
detect events such as USB insertion and volume mounting to perform  
certain actions.  I was wondering if there was a launchd.plist key  
that allowed for launchd to detect an application startup.


One approach is to have an agent monitor the audit trail to look for  
the application starting. The agent can then do something that can  
cause your app to launch, but now you are introducing a third program  
into the mix.


Todd

___

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

Please do not post 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


State of the Union videos?

2009-06-12 Thread Todd Heberlein
Does anyone know if/when Apple will post the "State of the Union"  
presentations from WWDC 09?


Todd

___

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

Please do not post 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: Discussion to splinter off cocoa-dev list

2009-06-12 Thread Todd Heberlein
so grueling and satisfying at the same time, we may never know. With  
all the new functionality (APIs) to be provided in 10.6 and for the  
iPhone 3.0, I wonder if it would be worth having some frank  
discussion on if now is a good time to split off from this list some  
more focused discussion lists.


Well, I don't think the 10.6 stuff can be talked about in a public  
forum until after it ships in September. There is a forum site at developers.apple.com 
 on which NDA-related stuff can be discussed.


I was part of many discussions that revolved not around demanding  
new features per-se', but more of hashing things out among  
developers and engineers in order to get something coherent to  
submit as a Radar or Enhancement/Bug report.


I find writing a good bug report very time consuming. I have to  
isolate the problem, develop the simplest example possible to allow  
the engineers to reproduce the problem, then write up instructions on  
reproducing it, what should be seen, what is actually seen, etc. In  
short, it is sort of like writing a mini-academic paper. But I have  
been very pleased with the responses I've gotten from Apple for my  
efforts, so I usuallly feel it is worth it.


One trouble we already have is cross-posting or posting to the wrong  
list. Using launchd to launch a Cocoa app for example should probably  
be taken to the Darwin mailing list, but if someone is already a  
subscriber to Cocoa, they probably don't know about the Darwin list or  
don't want to subscribe just to post a single question. So it gets  
posted to this mailing list. With more focused mailing lists I fear  
there will just be more emails sent to the wrong mailing lists.


Maintaining "mailing list purity" is always a challenge. At which  
point, a moderator should probably come along and respond to this  
email as "off topic" for this mailing list.  ;^)


Todd

___

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

Please do not post 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: Securely limit the running an application by serial number

2009-07-03 Thread Todd Heberlein

This is for limited use, and isn't a product for the masses.


There has already been some pretty good stuff posted, but just keep in  
mind that once you've released your code, if someone is really  
interested in modifying your code, they probably will. I doubt there  
will ever be a 100% guaranteed solution.


The military has been investigating elements of this for a few years  
with respect to unmanned combat vehicles (they know they are going to  
be captured by their enemy, so for a variety of reasons they want to  
protect the code), so you may want to look around at DARPA and DARPA  
contractors to see what unclassified papers have been published.


Todd

___

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

Please do not post 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


Using private APIs

2009-07-09 Thread Todd Heberlein
From time to time someone posts a question about using non-public  
Apple APIs -- you know, the ones that let you do something really cool  
or fast but causes your app to break on a future OS release. :)   
Anyways, I saw this purported private API for OS X, and I thought I'd  
share it. Pretty funny. :)


From:
http://ericasadun.com/iPhoneDocs300/_u_i_view_controller-_u_i_view_controller_class_dump_warning_8h-source.html

@interface UIViewController (UIViewControllerClassDumpWarning)

- (void)attentionClassDumpUser:(id)fp8
yesItsUsAgain:(id)fp12
althoughSwizzlingAndOverridingPrivateMethodsIsFun:(id)fp16
itWasntMuchFunWhenYourAppStoppedWorking:(id)fp20
pleaseRefrainFromDoingSoInTheFutureOkayThanksBye:(i))fp24;

@end


Todd

___

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

Please do not post 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: testing your app on a virtual machine?

2009-07-15 Thread Todd Heberlein
Is there anyway one can install an OSX system on a virtual machine  
for testing purposes?


Check the EULA for Mac OS X Server. I think you can run that under a  
VM, and I think VMWare has support for it in either the current or  
future version.


Todd

___

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

Please do not post 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: Finding an available port for chat

2009-07-17 Thread Todd Heberlein
but there will be persons like myself with draconian isp who block  
gobs of ports and make it hard to for chat apps to work.


There are a lot of very good reasons for a Draconian policy like  
that. :)



how can I, in a reasonably economic way, find an open port to talk on?


Are you trying to specify a specific port on your machine you know  
will get past the ISP's filtering? Or are you just trying to find a  
random high-numbered port that the ISP will unlikely have blocked? Or  
are you trying to get around the blocking in general.


If you drop down to Berkeley sockets layer, you can specify a port for  
your server, or you can pass 0 as the port and the server will  
(somewhat) randomly choose a high numbered port for you. If you think  
lots of potential users are going to suffer port filtering, you could  
set up a server somewhere else on the Internet and have both users  
connect to that. For example, user's A and B connect to each other by  
connecting to a third machine C. That way neither user A or B need to  
have their machine open up a server on their machine.


Todd

___

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

Please do not post 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


Avoiding KVO in dealloc?

2009-08-03 Thread Todd Heberlein
While working through "Beginning iPhone 3 Development" I've seen the  
following a lot, and it seems like a general Cocoa issue.


In -viewDidUnload methods the code has the form:
self.foo = nil;

Whereas in -dealloc methods the code has the form:
[foo release];

Both methods seem to me to do the same thing (releasing foo), but I  
presume the first one would trigger any KVO observers where as the  
second wouldn't. Is that why the simple "release" is used instead of a  
setter in the dealloc methods, to avoid KVO? Is this a general Cocoa  
pattern?


Thanks,

Todd

___

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

Please do not post 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: Notification for launch of root daemon process?

2009-08-17 Thread Todd Heberlein
Is there some notification that's posted by the OS when a root  
daemon process is launched?  Here's what I've tried:


Off the Cocoa topic, but I track processes using the BSM audit trail.

Todd

___

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

Please do not post 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: devil of a time with an NSImageView

2009-08-19 Thread Todd Heberlein
 The standard practice is to start any nib-dependent startup stuff  
on -awakeFromNib ... forcing it to load seems dirty. :-)


or
-viewDidLoad

on the iPhone (?).

Todd

___

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

Please do not post 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: Authorization Question (Possibly a simple POSIX question?)

2009-08-21 Thread Todd Heberlein
I don't understand how the app allowed to use that file descriptor  
to read the file's contents.


Its a general UNIX thing. If you have a book on UNIX interprocess  
communications, you can probably find some details in it. And as  
others have pointed out, permissions are checked at the time of the  
initial open only.



but how can another process just start using that descriptor? Is it  
because it's the parent process?


I am pretty sure your helper tool's parent process is actually the  
launchd process which is owned by root.



The app only preauthorized some arbitrary right, it didn't actually  
get any privileges to open and read a protected file.


Authorization in MacOS X is a little difficult for me to get my head  
around, but here is what I think is happening. When you authorize or  
preauthorize, you can have those authorization rights credentials  
stick around for a specified period of time. This authorization  
credential cache is global, so other processes can look into it. Then  
later when another process (i.e., your HelperTool) needs authorization  
to do something, like opening the file, it first checks the cache to  
see if you already have the credential. If so, it doesn't bother to  
prompt you again to access your password.


One reason to preauthorize in your Cocoa app is simply to prevent your  
code from launching the helper tool if you aren't going to be able to  
provide the right information (i.e., password) in the first place.


Todd

___

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

Please do not post 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


virtual ivars

2009-08-29 Thread Todd Heberlein
I've been playing with KVC and KVO with my own setters and getters  
(along with Controllers) to create virtual ivars. That is, there never  
is any storage created for the variable and its value is calculated on  
the fly when the getter is called. This seems to have some cool  
potential, but it raises the following question:


Could this break with future Xcode or OS X upgrades?

In other words, is this approach an officially supported way to code  
by Apple, or do they have the freedom to break this in the future?



Thanks,

Todd


Simple example where the ivar "myInt" never really exists:

@interface MyObj : NSObject  {
NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;

-(int)myInt;
-(void)setMyInt:(int)newVal;

@end




-(int)myInt
{
return 43;
}

-(void)setMyInt:(int)newVal
{
// do nothing right now
}


___

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

Please do not post 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: virtual ivars

2009-08-29 Thread Todd Heberlein

If you can't set a value, don't provide a setter.


I see from another post I was conflating "ivars" with "properties".  
With regards to the setters, I have some C++ libraries, and I was  
thinking about having "property" wrappers in an Objective C object  
doing setting and getting into values in the C++ object. I just didn't  
want to make the demo code very long. My bad for a poor example.


Todd

___

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

Please do not post 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: virtual ivars

2009-08-29 Thread Todd Heberlein
I see from another post I was conflating "ivars" with "properties".  
With regards to the setters, I have some C++ libraries, and I was  
thinking about having "property" wrappers in an Objective C object  
doing setting and getting into values in the C++ object.


So here is a slightly more detailed scenario while still trying to  
keep it as simple as possible.


My "Model" is captured in C++ code (i.e., "CppObj" below). I want to  
use normal Cocoa "View" objects (e.g., an NSTextField) and  
"Controller" objects (e.g., NSObjectController). So I create an  
Objective C object ("MyWrapper ") to wrap the C++ object, and access  
to the C++ content is done through "properties". Both the setters and  
getters reach down into the C++ object to set or get its values.


Things seem to be working. I just wanted to make sure I wasn't doing  
something illegal or not supported. I guess I have always had  
properties associated with actual variables, so it never occurred to  
me before that they are really independent things.


Todd


//- C++ model 
class CppObj {
public:
int myInt;
};


//- Objective-C++ wrapper 
@interface MyWrapper : NSObject  {
CppObj* p_cppObj;
}
-(int)myInt;
-(void)setMyInt:(int)newVal;
@end



//- getter/setter wrappers of C++ model 
-(int)myInt
{
return p_cppObj->myInt;
}

- (void)setMyInt:(int)newVal
{
p_cppObj->myInt = newVal;
}


___

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

Please do not post 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: Wow! Just installed OPENSTEP ENTERPRISE 4.2

2010-08-06 Thread Todd Heberlein
> I had a shrinkwraped OPENSTEP Enterprise 4.2 CD from March 1997 in my file 
> cabinet, so I just installed it on a crap 1.83GHz Core 2 (not-duo) running 
> Windows XP SP3.

I wonder how much value it lost when you removed the shrink wrap?

I've kept only two old computers with me over the years -- a Mac SE/30 and my 
original NeXTstation color slab. I remember when working on those computers 
that I really did feel like I was taking a significant step forward into the 
future.

Objective C, NIBs, the basic AppKit architecture, and so much more that Avie 
and those other key players brought us is those early days are still here in 
one form or another. Those early developers were like prophets in the 
wilderness when few were listening. Now I see so many Macs and iOS systems 
being sold, and I feel like I can say, "Yes, they were right."


> Alternately, it is sad how little Cocoa development has improved in 13 years.

It took a lot longer to bring out Mac OS X than I expected after the 
acquisition. We never got our "yellow box" for windows (with the promised free 
runtime libraries). Display Postscript was ripped out. I remember feeling a 
little afraid when Steve announced Carbon saying that the old Mac APIs were 
still the company's crown jewels. It was not a straight line from OPENSTEP to 
Snow Leopard and iOS 4, but we got here.

Today I have troubles imaging new things I really want in a future Mac OS 
releases. If there is one thing I want, I guess it is a big push in resolution 
independence. I don't feel it has gotten much attention since Apple first 
announced it a few years ago. I think Mac OS X on retina display quality 
monitors would be cool and truly immersive, but resolution independence needs 
to be ubiquitous for that to happen.

Todd

___

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

Please do not post 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


Cocoa Drawing vs. Quartz Drawing

2011-01-22 Thread Todd Heberlein
In a Cocoa app is there a preference for using the Cocoa or the Quartz drawing 
routines?
___

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

Please do not post 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


NSScrollView, centering document view?

2011-01-29 Thread Todd Heberlein
When working with an NSScrollView, sometimes my document view is smaller than 
my content/clip view. (the document view's size is dynamically generated 
depending on the data that needs to be rendered; or the user may make the 
window much larger than the document view.)  In these cases I would like to 
have my document view centered inside the clip view (as opposed to being 
anchored in the lower-left corner as it currently is. I tried changing the 
document view's frame's origin, but this didn't appear to have any effect.

Is there an easy way to do this? Or should I make sure my document view is 
always at least as large as the content view and then just center my drawing 
inside my document view?

Thanks,

Todd

___

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

Please do not post 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


text orientation/positioning with layout manager

2011-01-31 Thread Todd Heberlein
I'm doing a simple experiment using NSTextStorage, NSLayoutManager, 
NSTextContainer to draw some text (I am basing this on the CircleView example 
because I want some of that orientation power later).

I have found that when rendering the text using 
drawGlyphsForGlyphRange:atPoint:, I don't get the text where I expected. It is 
higher than I expect. Furthermore, when I draw a rectangle around the text (or 
try to) using the rectangle from usedRectForTextContainer:, the text is outside 
the rectangle (in short, the rectangle is where I expect it to be, but the text 
glyphs are not).

Is there a secret incantation that I am missing?

Thanks,

Todd

Basic code snippet:

point = NSMakePoint(1.0, 1.0);
glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
usedRect = [layoutManager usedRectForTextContainer:textContainer];
usedRect.origin = point;

[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:point];
[[NSBezierPath bezierPathWithRect: rect] stroke];
___

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

Please do not post 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


Sandboxing and "helper apps"

2012-05-29 Thread Todd Heberlein
 In the past you could include a full UNIX application inside a Mac application 
bundle. For example, in the directory

MyApp.app/Contents/MacOS

could be the Cocoa executable "MyApp" and the UNIX executable "my_helper_app".

In addition to running this helper app from the Cocoa app, this UNIX app could 
be launched by the command line from a Terminal application

$ /Applications/MyApp.app/Contents/MacOS/my_helper_app -i 
/Users/Todd/some_file

or via a launchd configuration to be run in the background when I log in.


Is this functionality no longer allowed with Sandboxing?


Thanks,

Todd

___

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

Please do not post 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: Sandboxing and "helper apps"

2012-05-30 Thread Todd Heberlein

On May 30, 2012, at 4:53 AM, Stephane Sudre wrote:

> It's allowed. IIRC, when the helper app is launched from the main
> application, it inherits the entitlements/restrictions of its parent.

I thought (and I'm barely getting up to speed on this) if the program was 
launched as an NSTask, it would inherit the entitlements & container of the 
parent. If it was launched as an XPC service it would have its own entitlements 
and container.

But… if the program is launched from a Terminal window or by launchd (e.g., 
scheduled to run at midnight), what then?  Does it run like a normal UNIX 
program with no sandboxing?  What if this UNIX helper app is copied to a 
different directory?  Does Apple forbid a program from MAS that can be launched 
this way or if the developer induces its users to run it this way?

Todd


___

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

Please do not post 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

QTKit from UNIX app?

2012-06-09 Thread Todd Heberlein
Probably a naive question, but can I use QTKit (or is there a better library?) 
to capture images (or videos) inside a UNIX helper application?


I've never tried using Cocoa (and related) objects outside a regular Cocoa 
application with a GUI, NSApplicationMain(), etc. Is this generally prohibited?

Thanks,

Todd

___

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

Please do not post 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


  1   2   >