Re: private methods and variables

2008-07-30 Thread Torsten Curdt

Even more interesting :) Thanks for sharing that Bill.

I've had another idea: Using a protocol would also be a way of  
shielding the framework from the implementation details.
The only problem is that class methods are not allowed in a protocol.  
And the framework's main entry class currently uses a singleton pattern.


cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: private methods and variables

2008-07-30 Thread Bill Bumgarner

On Jul 30, 2008, at 12:36 AM, Torsten Curdt wrote:

Even more interesting :) Thanks for sharing that Bill.

I've had another idea: Using a protocol would also be a way of  
shielding the framework from the implementation details.
The only problem is that class methods are not allowed in a  
protocol. And the framework's main entry class currently uses a  
singleton pattern.


Where does it say that protocols can't include class methods?  If  
there is documentation indicating as much then there is a bug  
somewhere and I'd like to know about it.


The following works as expected -- the compiler complains mightily  
about the lack of conformance to protocol Bob in class Fred.


@protocol Bob
+ (void) foo;
@end

@interface Fred : NSObject 
@end
@implementation Fred
@end

---

However, protocols are not generally used to hide implementation  
details.   It sounds more like you want a combination of public and  
private headers / declarations.


For Cocoa, functionality that is supported is made available through  
public headers.  Functionality that is internal to Cocoa is  
encapsulated in private headers that declare said private interfaces  
through a combination of categories, class extensions and full-on  
class declarations.


b.bum

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

"get" prefixes in Cocoa

2008-07-30 Thread Sumner Trammell
Hi. Cocoa idioms dictate setFoo: and foo: for setters and getters.
Occasionally, the prefix "get" appears in a Cocoa method, like this
one:


- (void)getObjects:(id *)objects andKeys:(id *)keys


When a method is prefixed with get in Cocoa, what is being expressed?


Thanks,
-s
___

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

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

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

This email sent to [EMAIL PROTECTED]


Is the WebView inspector buggy in Interface Builder 3.0?

2008-07-30 Thread Sumner Trammell
Hi, is anyone else having problems with the WebView inspector in
Interface Builder 3.0?

I have a window with a WebView on it in MyDocument.nib.

When I open MyDocument.nib, the WebView attributes inspector shows
font sizes of 12 and 12 for default and fixed fonts.  It also shows
Java enabled.


I change the default and fixed font sizes to 16 and 13.

I uncheck the checkbox to disable Java.

I save the nib.

I reopen the nib.

The WebView inspector again shows font sizes of 12 and 12 for default
and fixed fonts, and Java enabled.

I've resorted to setting the params manually in
windowControllerDidLoadNib: like this:

[[webView preferences] setDefaultFixedFontSize:10];
[[webView preferences] setDefaultFontSize:14];
[[webView preferences] setJavaEnabled:NO];



I have also noticed some of the fields/controls in the WebView
inspector changing randomly when I'm in that inspector making changes.

Thanks,
-s
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: "get" prefixes in Cocoa

2008-07-30 Thread Rob Ross
the "get" idiom means that you are passing in pointer arguments to  
the method, and the method will mutate(modify) the pointed-to  
objects. It's an alternate way of retrieving data from a method call  
as opposed to the usual function return value.



Rob Ross, Lead Software Engineer
E! Networks

---
"Beware of he who would deny you access to information, for in his  
heart he dreams himself your master." -- Commissioner Pravin Lal




On Jul 30, 2008, at 1:11 AM, Sumner Trammell wrote:


Hi. Cocoa idioms dictate setFoo: and foo: for setters and getters.
Occasionally, the prefix "get" appears in a Cocoa method, like this
one:


- (void)getObjects:(id *)objects andKeys:(id *)keys


When a method is prefixed with get in Cocoa, what is being expressed?


Thanks,
-s
___

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

Please do not post 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/rob.ross%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: private methods and variables

2008-07-30 Thread Peter N Lewis

At 11:02 PM +0200 29/7/08, Torsten Curdt wrote:
Especially for a framework I don't want to expose implementation 
details to the interface.


Others have pointed out that you cannot add ivars in the implementation.

However, if you can control the creation of your objects via a 
factory function or other means, then you can have a private subclass 
that has ivars and never actually create the published class per se.


For example (typed in email)

.h file:

@interface MyClass
-(void) publicMethod;

+(MyClass*) allocate;
@end

.m file

@interface MyRealClass : MyClass
{
  int privateVariable;
}
-(void) privateMethod;
@end

@implementation MyClass
-(void) publicMethod { }

+(MyClass*) allocate
{
  return [MyRealClass alloc];
}
@end

@implementation MyRealClass
-(void) privateMethod { }
@end

I've used this technique a fair amount in C++, but, being a novice, 
not much yet in Objective C, but it should work.  I'm not sure 
whether it would be a good idea to for the method named allocate to 
be named alloc or not.  Possibly that would mean it would work even 
if you couldn't control the creation of the class, I'm not sure.


One downside is that Interface Builder does not seem to read .m files 
(even if you actively drag them to it), so you can't have any 
IBOutlets in MyRealClass unless you put it in a (potentially private) 
header file.


Hopefully this makes as much sense in Objective C as it does in C++, 
otherwise I'm sure someone will correct me.


Enjoy,
   Peter.

--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

Keyboard Maestro  Macros for your Mac
   
___

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

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

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

This email sent to [EMAIL PROTECTED]


Dragging a header file to XIB Dock

2008-07-30 Thread Nelson Hazeltine


I am new to IB and Cocoa.

When I drag and drop a header file containing interface information to  
the XIB dock, it doesn't work, i.e., nothing happens.  As near as I  
can tell, the header file is okay.  I am wanting to get the the object  
browser.


Any suggestions?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Multithreaded file read

2008-07-30 Thread Roger Herikstad
Hi,
 I was wondering if anyone on the list has a solution for my problem.
I'm keeping a number of files containing indices into a big (>2GB)
data file. I have a cocoa program that will read these index files and
fetch the appropriate data from the big file, plot it and store as an
image. I would like to run these print operations in parallel, but I'm
concerned that a conflict will arise if two threads are reading into
the same file. The index files are not disjoint, so a particular data
vector could be requested by several threads. Is there a way to handle
this in cocoa? The big file resides on a local network server and is
shared over nfs. Thanks!

~ Roger
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Dragging a header file to XIB Dock

2008-07-30 Thread Matthew Schinckel
Create a new NSObject, and in the Inspector change it to the class  
that your header file defines.


On 30/07/2008, at 12:09 PM, Nelson Hazeltine wrote:



I am new to IB and Cocoa.

When I drag and drop a header file containing interface information  
to the XIB dock, it doesn't work, i.e., nothing happens.  As near as  
I can tell, the header file is okay.  I am wanting to get the the  
object browser.


Any suggestions?
___

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

Please do not post 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/matt%40schinckel.net

This email sent to [EMAIL PROTECTED]


--
Matthew Schinckel <[EMAIL PROTECTED]>

The Feynman Problem-Solving Algorithm:
 (1) write down the problem;
 (2) think very hard;
 (3) write down the answer.



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: private methods and variables

2008-07-30 Thread Torsten Curdt
Where does it say that protocols can't include class methods?  If  
there is documentation indicating as much then there is a bug  
somewhere and I'd like to know about it.


The following works as expected -- the compiler complains mightily  
about the lack of conformance to protocol Bob in class Fred.


@protocol Bob
+ (void) foo;
@end

@interface Fred : NSObject 
@end
@implementation Fred
@end


Got it working now!

I had

@protocol Bob
+ (Bob *)sharedBob; // error: syntax error before 'Bob'
@end // warning: '@end' must appear in an @implementation context

@interface Fred : NSObject 
...
@end

but it needs to be:

@protocol Bob
+ (NSObject *)sharedBob;
@end

However, protocols are not generally used to hide implementation  
details.   It sounds more like you want a combination of public and  
private headers / declarations.


Definitely sounds like that. Basically I have a framework entry  
(public header)


@interface Bob {
 @private
some ivars here
}
+ (Bob *)sharedBob;
- (void)someMethods;
@end

And I would rather have it look like this in public.

@interface Bob
+ (Bob *)sharedBob;
- (void)someMethods;
@end

Still I need those ivars in private though.

For Cocoa, functionality that is supported is made available through  
public headers.  Functionality that is internal to Cocoa is  
encapsulated in private headers that declare said private interfaces  
through a combination of categories, class extensions and full-on  
class declarations.


Any pointers on how this is done?

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CSV parsing (large files)

2008-07-30 Thread Andreas Monitzer

On Jul 30, 2008, at 08:14, Simone Tellini wrote:

Keep a prepared SQLite insert statement and reuse it for all the  
lines, binding the parameters for each line. Don't load the whole  
file in memory: it's just a waste of memory and time to allocate it.  
Instead parse a line at a time.


mmap() might also be an option.

andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: private methods and variables

2008-07-30 Thread Jean-Daniel Dupas


Le 30 juil. 08 à 11:26, Torsten Curdt a écrit :

Where does it say that protocols can't include class methods?  If  
there is documentation indicating as much then there is a bug  
somewhere and I'd like to know about it.


The following works as expected -- the compiler complains mightily  
about the lack of conformance to protocol Bob in class Fred.


@protocol Bob
+ (void) foo;
@end

@interface Fred : NSObject 
@end
@implementation Fred
@end


Got it working now!

I had

@protocol Bob
+ (Bob *)sharedBob; // error: syntax error before 'Bob'
@end // warning: '@end' must appear in an @implementation context

@interface Fred : NSObject 
...
@end

but it needs to be:

@protocol Bob
+ (NSObject *)sharedBob;
@end

However, protocols are not generally used to hide implementation  
details.   It sounds more like you want a combination of public and  
private headers / declarations.


Definitely sounds like that. Basically I have a framework entry  
(public header)


@interface Bob {
@private
   some ivars here
}
+ (Bob *)sharedBob;
- (void)someMethods;
@end

And I would rather have it look like this in public.

@interface Bob
+ (Bob *)sharedBob;
- (void)someMethods;
@end

Still I need those ivars in private though.

For Cocoa, functionality that is supported is made available  
through public headers.  Functionality that is internal to Cocoa is  
encapsulated in private headers that declare said private  
interfaces through a combination of categories, class extensions  
and full-on class declarations.


Any pointers on how this is done?

cheers
--
Torsten


The true question is why you need this ?
I don't see any valid reason to require this kind of constraint.

Now, if you really want something like this, I bet the cleaner way is  
to use class cluster, but it will prevent your framework user to  
subclass Bob.
An other common way is to hide your ivar in an opaque struct (or  
another object with forward declaration only):


@interface Bob {
@private
   struct __OpaqueBobIVars *ivars;
}
+ (Bob *)sharedBob;
- (void)someMethods;
@end


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: private methods and variables

2008-07-30 Thread Torsten Curdt

Any pointers on how this is done?


The true question is why you need this ?
I don't see any valid reason to require this kind of constraint.


Well, those ivars while private still expose internal classes to the  
interface. I would like to avoid that for encapsulation purposes.


Does that make sense? Or am I going here a little too far?

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: global NSMutableDictionary

2008-07-30 Thread Michael Ash
On Tue, Jul 29, 2008 at 10:07 PM, Greg Parker <[EMAIL PROTECTED]> wrote:
> Michael Ash wrote:
>>
>> On Tue, Jul 29, 2008 at 2:04 PM, Bill Bumgarner <[EMAIL PROTECTED]> wrote:
>>>
>>> Or you could annotate a function as a constructor.  It will run before
>>> main().
>>> static void __InitializeGlobalStuffMan(void) __attribute__
>>> ((constructor));
>>> void __InitializeGlobalStuffMan(void) {
>>>   myGlobalDictionary = [[NSMutableDictionary alloc] init];
>>>   
>>> }
>>
>>
>> Is this safe to do? I would be afraid that this might execute before
>> the ObjC runtime is initialized, leading to pain and possibly hilarity
>> when the objc_msgSends execute.
>
> It's safe, usually.
>
> The runtime always goes first. You can't run code that uses a class before
> the runtime sets up that class. However, if the class has +load methods or
> C/C++ constructors of its own, then it may be possible to use the class
> before it is ready for you.
>
> The initialization order is complicated, but in general:
> 1. All libraries you link to are ready for use before any of your code runs.
> 2. All of your own classes are prepared by the runtime before any of your
> code runs.
> 3. All of your +load methods are called before any of your C/C++
> constructors.
> 4. Superclass +load always runs before subclass +load.
>
> It is possible for one of your constructors or +load methods to use another
> one of your classes before its own +load is called, so be careful if you
> have complicated constructor work or constructor work in more than one
> place.

Thanks for all the info. I'm still a bit confused on one point,
though. You say that if the class has a +load method or C++
constructors then it may not be ready. You also say that libraries you
link to are ready to use before my code runs. Are +load and
constructors exceptions to this rule, or are +load and constructors
only a potential problem if used in my own application code?

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Multithreaded file read

2008-07-30 Thread Michael Ash
On Wed, Jul 30, 2008 at 2:06 AM, Roger Herikstad
<[EMAIL PROTECTED]> wrote:
> Hi,
>  I was wondering if anyone on the list has a solution for my problem.
> I'm keeping a number of files containing indices into a big (>2GB)
> data file. I have a cocoa program that will read these index files and
> fetch the appropriate data from the big file, plot it and store as an
> image. I would like to run these print operations in parallel, but I'm
> concerned that a conflict will arise if two threads are reading into
> the same file. The index files are not disjoint, so a particular data
> vector could be requested by several threads. Is there a way to handle
> this in cocoa? The big file resides on a local network server and is
> shared over nfs. Thanks!

There are (at least) three reasonable options. I shall let you decide
which fits best:

1) The POSIX pread() function does not have the concept of a "cursor".
Instead, you tell it where to read from the file with each call. It is
safe to share a single file descriptor among multiple threads which
are all calling pread() on it.

2) Nothing says you can't open a single file more than once. Open it
in each thread, then read. Each time you open the file, you'll get an
independent cursor into it, so the individual threads won't interfere
with each other. However, be aware that open file descriptors are a
relatively scarce resource (hundreds to thousands) so depending on
your design this could cause problems. If you have, say, four threads
then this is not really a concern. You can do this with low-level
POSIX functions, with C stdio, or with NSFileHandle or NSStream.

3) Memory map the file, then read the mapped memory. Cocoa makes this
really easy using NSData. However, with a 2+GB file, you'll have
trouble ensuring that it fits into your address space unless you're
building exclusively for 64-bit. It is also difficult to gracefully
recover from errors when using memory mapping; if your NFS share
disappears and you're using one of the previous techniques then your
reads will return errors, but when using memory mapping you'll just (I
believe) segfault.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: private methods and variables

2008-07-30 Thread Michael Ash
On Wed, Jul 30, 2008 at 6:26 AM, Torsten Curdt <[EMAIL PROTECTED]> wrote:
>>> Any pointers on how this is done?
>>
>> The true question is why you need this ?
>> I don't see any valid reason to require this kind of constraint.
>
> Well, those ivars while private still expose internal classes to the
> interface. I would like to avoid that for encapsulation purposes.
>
> Does that make sense? Or am I going here a little too far?

You're going a little too far. While you're showing it to outsiders,
you're not really *exposing* it, because there's nothing they can
legally do with the knowledge.

Encapsulation just means that outsiders don't rely on internal
implementation details of your class, so that you can change that
implementation without breaking clients. A private or protected
(protected is the default) instance variable, while visible to such
clients, still can't be used by them, so you can change it without
breaking them.

The fact that you have to put it in the header at all is just a quirk
of how the language is implemented. Subclasses need to know the total
size of their superclasses, so all instance variables must go in the
header. But it's still encapsulated, so don't worry about it.

(A big exception: if you are writing code which must remain *binary*
compatible with other code that may subclass your classes, an
exceedingly rare but possible scenario, then you must ensure that the
size of your superclass never grows from one version to the next, even
using private ivars.)

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Two different actions depending on the event when clicking a NSStatusItem?

2008-07-30 Thread tim_ph
Hi there.

My application uses a NSStatusItem. When somebody left-clicks on it I want
a method to be called (Which I've managed to fix) and then when somebody
right-clicks on it I want a menu to be shown. I can't seem to get that to
work. If I set a menu for the status item it shows up when somebody
left-clicks on it and the other method isn't called.

How do I fix it so that when somebody right-clicks on it, the menu shows
and when somebody left-clicks on it the other method is called?

Any help is appreciated.

/Tim Andersson

___

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

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

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

This email sent to [EMAIL PROTECTED]


AuthorizationExecuteWithPrivileges flag error

2008-07-30 Thread sheen mac
Hi All,

In my project , I added an executable and created AuthorizationRef
successfully.The AuthorizationCopyRights also worked without 
error.But when AuthorizationExecuteWithPrivileges , it shows
the invalid flags error.

Kindly help me.

Thanks In Advance,
Sheen

 OSStatus status;AuthorizationRef auth;
AuthorizationExternalForm extAuth;


if (geteuid() != 0) {
setuid(0);
}

if (fread(&extAuth, sizeof(extAuth), 1, stdin) != 1)
exit(-1);
if (AuthorizationCreateFromExternalForm(&extAuth, &auth))
exit(-1);


AuthorizationItem right = { RIGHT, 0, NULL, 0 };
AuthorizationRights rights = { 1, &right };
AuthorizationFlags flags = kAuthorizationFlagDefaults | 
kAuthorizationFlagExtendRights;


if (status = AuthorizationCopyRights(auth, &rights, 
kAuthorizationEmptyEnvironment, flags, NULL)) {
exit(-1);
}

char* args[3];
OSStatus err = 0;
FILE* iopipe;


args[0] = "-w";
args[1]="net.inet.ip.forwarding=1";
args[2]=NULL;

err = AuthorizationExecuteWithPrivileges(auth,
 "/usr/sbin/sysctl",
 flags, args, &iopipe);


if(err!=errAuthorizationSuccess)
fprintf(stderr,"failed\n"); 




  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Two different actions depending on the event when clicking a NSStatusItem?

2008-07-30 Thread Ron Fleckner


On 30/07/2008, at 10:08 PM, [EMAIL PROTECTED] wrote:


Hi there.

My application uses a NSStatusItem. When somebody left-clicks on it  
I want
a method to be called (Which I've managed to fix) and then when  
somebody
right-clicks on it I want a menu to be shown. I can't seem to get  
that to

work. If I set a menu for the status item it shows up when somebody
left-clicks on it and the other method isn't called.

How do I fix it so that when somebody right-clicks on it, the menu  
shows

and when somebody left-clicks on it the other method is called?

Any help is appreciated.

/Tim Andersson


What you want is called a contextual menu.  Find out how to implement  
it here:


There's even some sample code snippets.

Ron
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CSV parsing (large files)

2008-07-30 Thread Stephen Hoffman



From: Jacob Bandes-Storch
I've got several large-size CSV files (a total of about 1.25 million  
lines, and an average of maybe 10 or so columns) that I want to parse  
into a 2D array. I found some parsing code that uses NSScanner, and it  
works fine with small files, but it's very resource-intensive and slow  
with large files. Should I try and optimize it more, or try using C  
instead of Objective-C for parsing, or what?
  
This could be other end of the parsing (building and traversing the 
array), or some sort of a leak in the parser code.


Given you're doing this in production (why else worry about 
optimization?), there are open source libraries around that can deal 
with various of the foibles of this format.


Try libcsv, for instance.  (That C code is quite portable.)

Or extricate yourself from this particular format; CSV tends to be a 
"just fixing one more bug" file format, with no widespread agreement on 
escapements. 


There are tools and formats which are suited for larger data sets.




___

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

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

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

This email sent to [EMAIL PROTECTED]


[meeting] CocoaHeads Swindon, Monday August 4th

2008-07-30 Thread graham . lee
Hi all,

the next meeting of CocoaHeads Swindon will take place on Monday, 4th 
August.  In a grotesque example of self-promotion, I will be leading a 
discussion on "Designing a secure Cocoa application".  Details regarding 
the time and location can be found on the CH website:
http://cocoaheads.org/uk/Swindon/index.html

See you* there!
* [cocoaDevSubscribers intersectSet: peopleLivingNearSwindon];

Cheers,
Graham.



-- 
Graham Lee
Senior Macintosh Software Engineer, Sophos

Tel: 01235 540266 (Direct)
Web: http://www.sophos.com
Sophos - Security and Control

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Tim McGaughy


On Jul 29, 2008, at 9:22 PM, John Joyce wrote:


Does anybody have a means or a tool for checking for hackintoshes?
I really don't approve of such things and would like to leave clever 
messages on my own software if it is run on a hackintosh.


What's a hackintosh?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Steve Christensen

On Jul 30, 2008, at 8:55 AM, Tim McGaughy wrote:


On Jul 29, 2008, at 9:22 PM, John Joyce wrote:


Does anybody have a means or a tool for checking for hackintoshes?
I really don't approve of such things and would like to leave  
clever messages on my own software if it is run on a hackintosh.


What's a hackintosh?


A Windows PC that has been hacked to some extent so as to be able to  
install OS X. I didn't actually know myself, but Google is your  
friend. It looks like you first muck with the BIOS to make the PC  
friendlier to the OS installer and the OS itself, then away you go.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Devon Ferns
Someone hacks the OS X kernel to bypass Apple's checks for a legitimate 
Macintosh and usually posts it to some p2p site where people 
steal(copyright infringe) it and run it on their home build PCs.


Devon

Tim McGaughy wrote:


On Jul 29, 2008, at 9:22 PM, John Joyce wrote:


Does anybody have a means or a tool for checking for hackintoshes?
I really don't approve of such things and would like to leave clever 
messages on my own software if it is run on a hackintosh.


What's a hackintosh?

___

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

Please do not post 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/dferns%40devonferns.com

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: "get" prefixes in Cocoa

2008-07-30 Thread Ken Thomases

On Jul 30, 2008, at 3:11 AM, Sumner Trammell wrote:


Hi. Cocoa idioms dictate setFoo: and foo: for setters and getters.
Occasionally, the prefix "get" appears in a Cocoa method, like this
one:


- (void)getObjects:(id *)objects andKeys:(id *)keys


When a method is prefixed with get in Cocoa, what is being expressed?


From the guidelines discussed here :


Use “get” only for methods that return objects and values  
indirectly. You should use this form for methods only when multiple  
items need to be returned.


Cheers,
Ken___

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

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

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

This email sent to [EMAIL PROTECTED]


How to include reusable headers in Frameworks

2008-07-30 Thread Martin Häcker

Hi there,

I've come across a somewhat unique problem with writing frameworks,  
that I seem unable to find good information about with google. :/


Maybe one of you cocoa luminaries can shed some light on this.

My problem is this:
I have a framework which defines some objects. However I also build  
from the same source code some command-line tools which reuse that code.


Now, those shell-tools have to be deployed on 10.3.9 in an environment  
where I can't ship the frameworks with them (due to space constraints : 
( ).


Now my problem is this: How do I include the headers in that framework  
to achieve these goals:
a) I don't want to treat public and private headers differently (Since  
this framework has come to existance by refactoring, it currently has  
way to many public headers that I am gradually dropping - but that's  
another story)
b) I want to be able to use those objects and their header as is in  
the framework and in shell tools. (To keep those small and not have to  
ship the framework and all it's dependencies with the tools)


Well, a) has led me to include all headers, public or not by just  
using the framework form:


#import 

This works pretty well - but it also gives me a headache with b) as  
the compiler seems unable to find those headers and I had to switch  
some of the includes back to


#import "Header.h"

To make this work.

So I now have the practical problem, that I want and need to re-use  
some of the code in the framework outside of the context of a framework.


Is there a nice solution to this problem?

cu Martin
p.s.: if all else fails, I know that I can always write a macro that  
just generates the include form that I need - however I'd really like  
to not do that if there is another way. :/

___

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

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

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

This email sent to [EMAIL PROTECTED]


CALayer and CGContexts

2008-07-30 Thread John Clayton

Hi

I'm wanting to create a CGImageRef from a quartz based CGContextRef,  
so that I can feed a CALayer with it.   Is there a preferred way of  
doing this?  I did think of creating a CGLayer, drawing into it's  
context, and then creating a CGImageRef via a CIContext  
createCGImage:inRect: call - is that recommended?  Or is there a  
simpler way?


I do not want to simply use the delete drawLayer:inContext: method,  
because I need to be able to feed the image that I'm drawing into more  
than one layer.


Thanks
--
John Clayton
Skype: johncclayton




___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Checking for hackintosh

2008-07-30 Thread Abernathy, Joshua
Seeing as how the OS itself thinks it's running on Apple hardware, I
have no idea how you, running on the OS, would detect otherwise.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] On Behalf Of Devon Ferns
Sent: Wednesday, July 30, 2008 12:42 PM
To: Tim McGaughy
Cc: cocoa-dev@lists.apple.com
Subject: Re: Checking for hackintosh

Someone hacks the OS X kernel to bypass Apple's checks for a legitimate 
Macintosh and usually posts it to some p2p site where people 
steal(copyright infringe) it and run it on their home build PCs.

Devon

Tim McGaughy wrote:
> 
> On Jul 29, 2008, at 9:22 PM, John Joyce wrote:
> 
>> Does anybody have a means or a tool for checking for hackintoshes?
>> I really don't approve of such things and would like to leave clever 
>> messages on my own software if it is run on a hackintosh.
> 
> What's a hackintosh?
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/dferns%40devonferns.com
> 
> This email sent to [EMAIL PROTECTED]
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jabernathy%40burrislogi
stics.com

This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: private methods and variables

2008-07-30 Thread Bill Bumgarner

On Jul 30, 2008, at 2:26 AM, Torsten Curdt wrote:
For Cocoa, functionality that is supported is made available  
through public headers.  Functionality that is internal to Cocoa is  
encapsulated in private headers that declare said private  
interfaces through a combination of categories, class extensions  
and full-on class declarations.


Any pointers on how this is done?


Sure.  Coding in a Compose Window Never Compiles -- you have been  
warned.


Foo.h
-

@class FooPrivateStuff;
@interface Foo : NSObject
{
FooPrivateStuff *privateStuff;
}
... public API here ...
@end

Foo_Private.h
-

@interface FooPrivateStuff:NSObject
{
@protected
... ivars declared here ...
}
@end
@implementation FooPrivateStuff
... you can either decide to manage the ivars in this class OR you  
could simply treat this as a structure and access ivars through ->,  
see below ...


If you want to the ivars to be fully managed by this private class,  
then I would suggest implementing all of the ivars as non-atomic  
properties and synthesized accessors.   Don't forget your -dealloc in  
this case.


Personally, I would go with properties as it allows Foo to use KVO to  
handle change propagation in its internal private state.

@end

@interface Foo() // this is not a category -- a class extension --  
thus all API declared here must be implemented in class

 private API here
@end

Foo.m
-

#import "Foo.h"
#import "Foo_Private.h"

@implementation Foo
- init {
... standard -init dance ...
privateStuff = [FooPrivateStuff new];

// if FooPrivateStuff is just being used as a structure
privateStuff->bob = [Bob new];
privateStuff->count = 10;

// if FooPrivateStuff declared everything as @property
privateStuff.bob = [Bob new];
privateStuff.count = 10;
}

// if not using GC, you'll need this... of course, not using GC is  
generally a waste of time.

- dealloc {
[privateStuff->bob release]; // structure
privateStuff.bob = nil; // @property
[super dealloc];
}



So, why use a class and not a structure?

First, the garbage collector will precisely scan instances -- only  
scanning slots that have object references -- this is more efficient  
and avoids false references.   Secondly, it makes the code easy to  
refactor and enables the use of higher level mechanisms to manage the  
private stuff -- KVO, KVC, etc...   Finally, classes take care of  
allocating enough space for their instance variables across all  
architectures.


b.bum




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Checking for Hackintosh

2008-07-30 Thread Scott Lahteine

Hi,

There are a couple of ways to definitively test for a hackintosh. You  
could look at the IO Registry for unusual hardware configurations. But  
as it happens, the latest Hackintosh kernels all use custom Machine  
Type strings. So you can test to see if it's one of the known Mac  
models, and if it isn't you can assume it's probably a Hackintosh.


Unfortunately, this breaks if future Macs introduce new Machine Type  
strings, which is almost certain. You'll notice I'm not testing for  
AppleTV, for example, because I don't happen to know its string.


The following is what I use in "TabletMagic" to detect a TabletPC :


- (BOOL)detectHackintosh
{
  SInt32 gestaltReturnValue;
  BOOL is_known_mac = NO;
  if (!Gestalt(gestaltUserVisibleMachineName, &gestaltReturnValue))
  {
char *known_machines[] =  
{"AAPL","iMac","PowerBook","PowerMac","RackMac",

"Macmini","MacPro","MacBookPro","MacBook"};
StringPtr pmach = (StringPtr)gestaltReturnValue;
int i, len = pmach[0];
char *machine_string = (char*)malloc(len+2);
strncpy(machine_string, (char*)&pmach[1], len+1);

for (i=sizeof(known_machines)/sizeof(known_machines[0]); i--;)
  if (!strncmp(machine_string, known_machines[i],  
strlen(known_machines[i]))) { is_known_mac = YES; break; }


free(machine_string);
  }

  if (is_known_mac)
  {
// delete the tab having identifier "6"
[ tabview removeTabViewItem: [ tabview tabViewItemAtIndex:  
[ tabview indexOfTabViewItemWithIdentifier: @"6" ] ] ];

  }

  return !is_known_mac;
}



--
  Scott Lahteine  Thinkyhead Software
  [EMAIL PROTECTED]http://www.thinkyhead.com/


___

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

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

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

This email sent to [EMAIL PROTECTED]


readFromURL for the current document window, versus a new document window

2008-07-30 Thread John Love
The challenge is what to override in MyDocument such that when I select
"Open..." I can load a file into the currently active window *if* there is
an active window; *and* if no active document window, then do the standard
Cocoa stuff, that is, [super readFromURL ...] and load the file into the
newly created window.

I have poured over the Cocoa docs about document based apps and have
overridden readFromURL: ... but a new window always appears with the file,
even if there previously was a window active.  It appears, based on my
skimpy knowledge, that NSDocumentController's call to openDocument: leads to
addDocument:, i.e, a new document window.

John Love
___

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

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

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

This email sent to [EMAIL PROTECTED]


outlineView:dataCellForTableColumn:item: and bindings don't mix? Editing doesn't stick.

2008-07-30 Thread Sean McBride
Hi all,

Anyone using NSOutlineView's outlineView:dataCellForTableColumn:item:
delegate message?  I'm trying to use it exactly as used in the
DragNDropOutlineView example: to use a cell that will be used for the
entire row (ie a full width cell).

It works in the test app (which doesn't use bindings), but doesn't work
in my app that uses bindings.  I'm able to get the full width cell look,
but editing the cell stops working.  I can type a new value for the
cell, but pressing return/tab doesn't commit the new value.

This short sample shows the problem.


Anyone made full width cells work with bindings?

Cheers,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


registration code issues

2008-07-30 Thread David Harper
Hello,

My Cocoa Application is currently in beta, and there is a single beta tester 
who insists his registration code is not working.  I've extensively looked into 
the issue and it seems that the code works correctly up to the if statement 
which simply says:

if ([validCode isEqualToString:enteredCode]), and that isEqualToString is 
returning NO.

The code is a 28-digit numeric string broken into 7 chunks of 4 and separated 
by dashes as follows: ------.

I tried trimming both strings, and I also tried ignoring the dashes and 
checking substringWithRange: for ranges of length 4 with location incrementing 
by 5.  None of this has worked and the beta tester insists the code is still 
not working.

What do you think the odds are that the tester is trying to obtain an 
unprotected version?  It doesn't seem to me that it makes much sense to try to 
do such a thing, and so I'm inclined to believe him.  The program is built for 
10.4 or later and he is using 10.4, and most other testers are on 10.5.  Could 
there possibly be an issue with one of the built-in methods I take so much for 
granted?  (is it possible that isEqualToString is not working properly?)

I'd appreciate any advice or input.

Thanks,

- Dave H.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Sean McBride
On 7/30/08 2:06 PM, Abernathy, Joshua said:

>Seeing as how the OS itself thinks it's running on Apple hardware, I
>have no idea how you, running on the OS, would detect otherwise.

And any solution one comes up with is likely to be fragile and possibly
fail with new genuine hardware.  IMNSHO, you shouldn't try to detect
such things.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Charles Steinman
--- On Tue, 7/29/08, John Joyce <[EMAIL PROTECTED]> wrote:

> Does anybody have a means or a tool for checking for
> hackintoshes?
> I really don't approve of such things and would like to
> leave clever  
> messages on my own software if it is run on a hackintosh.

I really don't think that's a good idea. Hackintosh builders will just hack 
around it if they care, and you're just asking for the test to get tripped up 
and start accusing legitimate Mac users.

Cheers,
Chuck


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Dragging a header file to XIB Dock

2008-07-30 Thread Alex Heinz
More specifically, create a new object of whatever class your class is  
a subclass of (which, in most cases, is NSObject.)


Alex

On Jul 30, 2008, at 1:51 AM, Matthew Schinckel wrote:

Create a new NSObject, and in the Inspector change it to the class  
that your header file defines.


On 30/07/2008, at 12:09 PM, Nelson Hazeltine wrote:



I am new to IB and Cocoa.

When I drag and drop a header file containing interface information  
to the XIB dock, it doesn't work, i.e., nothing happens.  As near  
as I can tell, the header file is okay.  I am wanting to get the  
the object browser.


Any suggestions?
___

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

Please do not post 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/matt%40schinckel.net

This email sent to [EMAIL PROTECTED]


--
Matthew Schinckel <[EMAIL PROTECTED]>

The Feynman Problem-Solving Algorithm:
(1) write down the problem;
(2) think very hard;
(3) write down the answer.

___

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

Please do not post 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/aheinz2%40johnshopkins.edu

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Advice on printing multiple images

2008-07-30 Thread Eric Long
Hi,

I'm not new to Cocoa, but I haven't had to do much with printing until now.
I'm looking for advice about printing multiple images in varying formats.

I have an app that lets the user reference multiple image files in a list.
I want to allow the user to select however many files from the list and
print them.

I was envisioning each image as a "page" so the user could say print all
pages to print all the selected images, or choose pages 2-5 to print images
2-5 in the selection.

I see Cocoa wants to print by referencing a rect in a view.  In this case,
it doesn't make sense to load all the selected images (could be a lot) and
try to render them all at once into a view for printing.

What are some approaches I might take with this?


Thanks in advance for any comments.

Eric



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Kyle Sluder
On Tue, Jul 29, 2008 at 10:22 PM, John Joyce
<[EMAIL PROTECTED]> wrote:
> I really don't approve of such things and would like to leave clever
> messages on my own software if it is run on a hackintosh.

So what if you "don't care for such things."  You are setting yourself
up for a major liability when (not if) your code incorrectly detects a
valid machine as a Hackintosh, or you sell your software in a
jurisdiction which does not believe click-through EULAs to be
enforceable.

You are not Apple Legal, don't burden yourself with their responsibilities.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: registration code issues

2008-07-30 Thread Kyle Sluder
Have you actually determined that -isEqualToString: is returning NO,
or are you concluding that to be the result?  Can you send him a
special version that simply has NSLog(@"%@ == [EMAIL PROTECTED] %d", validCode,
enteredCode, [validCode isEqualToString:enteredCode]) and get a
Console log back?

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CALayer and CGContexts

2008-07-30 Thread David Duncan

On Jul 30, 2008, at 9:50 AM, John Clayton wrote:

I'm wanting to create a CGImageRef from a quartz based CGContextRef,  
so that I can feed a CALayer with it.   Is there a preferred way of  
doing this?  I did think of creating a CGLayer, drawing into it's  
context, and then creating a CGImageRef via a CIContext  
createCGImage:inRect: call - is that recommended?  Or is there a  
simpler way?


If you have a bitmap context, you can just call  
CGBitmapContextCopyImage() to get an image you can use from it. Can  
you explain your situation a bit more?

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: registration code issues

2008-07-30 Thread Gregory Weston

David Harper wrote:

My Cocoa Application is currently in beta, and there is a single  
beta tester who insists his registration code is not working.  I've  
extensively looked into the issue and it seems that the code works  
correctly up to the if statement which simply says:


if ([validCode isEqualToString:enteredCode]), and that  
isEqualToString is returning NO.


The code is a 28-digit numeric string broken into 7 chunks of 4 and  
separated by dashes as follows: ------.


I tried trimming both strings, and I also tried ignoring the dashes  
and checking substringWithRange: for ranges of length 4 with  
location incrementing by 5.  None of this has worked and the beta  
tester insists the code is still not working.


Have you generated output that leads you to believe that the strings  
really are the same?


What do you think the odds are that the tester is trying to obtain  
an unprotected version?  It doesn't seem to me that it makes much  
sense to try to do such a thing, and so I'm inclined to believe  
him.  The program is built for 10.4 or later and he is using 10.4,  
and most other testers are on 10.5.  Could there possibly be an  
issue with one of the built-in methods I take so much for granted?   
(is it possible that isEqualToString is not working properly?)


It's theoretically possible that you've hit some weird edge case, but  
I think that's the least likely answer. I've had software using  
isEqualToString: fairly heavily for the history of Mac OS X without  
running into an issue.


Honestly, my first guess would be that something's going wrong in the  
generation of validCode or the input of enteredCode and that the  
strings are legitimately not equal.


If you want to have a second person try it on 10.4, I can do a quick  
test (on a G5. My MacBook is running 10.5 and I'm not prepared to  
make a 10.4 Intel boot disk 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 [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread I. Savant
On Wed, Jul 30, 2008 at 3:09 PM, Charles Steinman
<[EMAIL PROTECTED]> wrote:

> I really don't think that's a good idea. Hackintosh builders will just hack 
> around it if they care, and you're just asking for the test to get tripped up 
> and start accusing legitimate Mac users.

  Agreed. A company I once worked for insisted that we must - MUST -
deride users who use known pirated keys. The developer in charge of
this feature made a simple mistake and in not-so-rare circumstances,
new users were falsely accused of pirating. Needless to say, the users
were quite upset by the accusations ...

  It's not your responsibility to enforce Apple's license terms, nor
is it wise to risk alienating your customers to force upon them your
ideals which only apply to your one application. Just another opinion
to add to the mix. But then, this debate has nothing to do with Cocoa.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How would you tell WebKit to keep all JavaScript popup windows on top/in front?

2008-07-30 Thread Rob Napier
There are likely several ways, but one way is to raise the window's  
level. When you create the window, use [window  
setLevel:NSFloatingWindowLevel] for those windows you want to float.


-Rob

--
Rob Napier -- Software and Security Consulting -- http://robnapier.net



On Jul 28, 2008, at 1:58 PM, Sumner Trammell wrote:


Hi, I've used WebKit to write a small Single-Site Browser that takes
you straight to a special section of the company intranet. It works
great, but there is one particular link on the page that creates a
popup window using JavaScript.  I want this popup to always stay on
top. In other words, I don't want the main window to ever hide the
popup. I'm not sure how to do this.  How would you tell WebKit to keep
all popup windows on top/in front?

Thanks,
-s

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Rob Napier

On Jul 30, 2008, at 2:54 PM, Sean McBride wrote:


On 7/30/08 2:06 PM, Abernathy, Joshua said:


Seeing as how the OS itself thinks it's running on Apple hardware, I
have no idea how you, running on the OS, would detect otherwise.


And any solution one comes up with is likely to be fragile and  
possibly

fail with new genuine hardware.  IMNSHO, you shouldn't try to detect
such things.


Agreed. Any effective solution will come in an update from Apple that  
prevents OS X itself from running. If Apple can't detect it when they  
control all the hardware, firmware, kernel and user-land software, and  
also have some financial incentive to solve it, it seems unlikely that  
a third-party user-land app is going to be more effective.


Any approach posted publicly in this forum will be defeated before the  
bits have dried.


-Rob

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: outlineView:dataCellForTableColumn:item: and bindings don't mix? Editing doesn't stick.

2008-07-30 Thread Corbin Dunn


Anyone using NSOutlineView's outlineView:dataCellForTableColumn:item:
delegate message?


Yes -- I have used it in a few places.


I'm trying to use it exactly as used in the
DragNDropOutlineView example: to use a cell that will be used for the
entire row (ie a full width cell).

It works in the test app (which doesn't use bindings), but doesn't  
work
in my app that uses bindings.  I'm able to get the full width cell  
look,

but editing the cell stops working.  I can type a new value for the
cell, but pressing return/tab doesn't commit the new value.

This short sample shows the problem.


Anyone made full width cells work with bindings?


Ah...with bindings. Xcode uses it with bindings, but they don't allow  
the "group rows" to be edited. The trouble is that the bindings go  
with the tablecolumn...and there really isn't a table column in that  
case. Have you tried manually handling the updates yourself w/the  
datasource method?


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: outlineView:dataCellForTableColumn:item: and bindings don't mix? Editing doesn't stick.

2008-07-30 Thread Sean McBride
On 7/30/08 12:52 PM, Corbin Dunn said:

>> Anyone using NSOutlineView's outlineView:dataCellForTableColumn:item:
>> delegate message?
>
>Yes -- I have used it in a few places.

No doubt. :)

>> I'm trying to use it exactly as used in the
>> DragNDropOutlineView example: to use a cell that will be used for the
>> entire row (ie a full width cell).
>>
>> It works in the test app (which doesn't use bindings), but doesn't
>> work
>> in my app that uses bindings.  I'm able to get the full width cell
>> look,
>> but editing the cell stops working.  I can type a new value for the
>> cell, but pressing return/tab doesn't commit the new value.
>>
>> This short sample shows the problem.
>> 
>>
>> Anyone made full width cells work with bindings?
>
>Ah...with bindings. Xcode uses it with bindings, but they don't allow
>the "group rows" to be edited. The trouble is that the bindings go
>with the tablecolumn...and there really isn't a table column in that
>case. Have you tried manually handling the updates yourself w/the
>datasource method?

I haven't tried that, but I will.

So is what I'm seeing a bug?  Should I file a radar?

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: outlineView:dataCellForTableColumn:item: and bindings don't mix? Editing doesn't stick.

2008-07-30 Thread Corbin Dunn

I'm trying to use it exactly as used in the
DragNDropOutlineView example: to use a cell that will be used for  
the

entire row (ie a full width cell).

It works in the test app (which doesn't use bindings), but doesn't
work
in my app that uses bindings.  I'm able to get the full width cell
look,
but editing the cell stops working.  I can type a new value for the
cell, but pressing return/tab doesn't commit the new value.

This short sample shows the problem.


Anyone made full width cells work with bindings?


Ah...with bindings. Xcode uses it with bindings, but they don't allow
the "group rows" to be edited. The trouble is that the bindings go
with the tablecolumn...and there really isn't a table column in that
case. Have you tried manually handling the updates yourself w/the
datasource method?


I haven't tried that, but I will.

So is what I'm seeing a bug?  Should I file a radar?


Yes, feel free to log a bug for bindings; we should come up with some  
standard/official way to make it work.


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Problem binding NSTextView's attributedString

2008-07-30 Thread Pete Callaway
Hi,

This is probably a simple question, but I'm having a spot of bother
with a bound NSTextView.

In IB I've set the text view's attributedString to be bound to the
file's owner with a model key path of
"document.selectedPage.stringContent". This is fine but when my
document's selectedPage property changes, the NSTextView doesn't
update to show the stringContent of the new selectedPage.

I've checked changes to selectedPage can be observed OK so I'm not
sure what I'm missing from the equation. Any tips?

Cheers,
Pete
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How would you tell WebKit to keep all JavaScript popup windows on top/in front?

2008-07-30 Thread Sumner Trammell
Thanks Rob.

-s


On Wed, Jul 30, 2008 at 3:35 PM, Rob Napier <[EMAIL PROTECTED]> wrote:
> There are likely several ways, but one way is to raise the window's level.
> When you create the window, use [window setLevel:NSFloatingWindowLevel] for
> those windows you want to float.
>
> -Rob
>
> --
> Rob Napier -- Software and Security Consulting -- http://robnapier.net
>
>
>
> On Jul 28, 2008, at 1:58 PM, Sumner Trammell wrote:
>
>> Hi, I've used WebKit to write a small Single-Site Browser that takes
>> you straight to a special section of the company intranet. It works
>> great, but there is one particular link on the page that creates a
>> popup window using JavaScript.  I want this popup to always stay on
>> top. In other words, I don't want the main window to ever hide the
>> popup. I'm not sure how to do this.  How would you tell WebKit to keep
>> all popup windows on top/in front?
>>
>> Thanks,
>> -s
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Triggering a notification?

2008-07-30 Thread Randall Meadows
Grrr, seems like I should know this, or at least be able to find out,  
but so far, no good.


What is the trick to triggering the controlTextDidChange: delegate  
method/notification when you set the text of a NSTextField (for  
instance) *programmatically*?



Thanks!
randy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Triggering a notification?

2008-07-30 Thread Nick Zitzmann


On Jul 30, 2008, at 3:31 PM, Randall Meadows wrote:

Grrr, seems like I should know this, or at least be able to find  
out, but so far, no good.


What is the trick to triggering the controlTextDidChange: delegate  
method/notification when you set the text of a NSTextField (for  
instance) *programmatically*?



You can just do this manually, like this: (warning - written in Mail,  
untested, use at your own risk, and all that)


[someTextField setStringValue:@"Hello world"];
[[NSNotificationCenter defaultCenter]  
postNotificationName:NSControlTextDidChangeNotification  
object:someTextField userInfo:[NSDictionary dictionaryWithObject: 
[[someTextField window] fieldEditor:YES forObject:someTextField]  
forKey:@"NSFieldEditor"]];


And yes, the delegate will get the message if you do that.

Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Triggering a notification?

2008-07-30 Thread Randall Meadows

On Jul 30, 2008, at 3:43 PM, Nick Zitzmann wrote:


On Jul 30, 2008, at 3:31 PM, Randall Meadows wrote:

Grrr, seems like I should know this, or at least be able to find  
out, but so far, no good.


What is the trick to triggering the controlTextDidChange: delegate  
method/notification when you set the text of a NSTextField (for  
instance) *programmatically*?


You can just do this manually, like this: (warning - written in  
Mail, untested, use at your own risk, and all that)


[someTextField setStringValue:@"Hello world"];
[[NSNotificationCenter defaultCenter]  
postNotificationName:NSControlTextDidChangeNotification  
object:someTextField userInfo:[NSDictionary dictionaryWithObject: 
[[someTextField window] fieldEditor:YES forObject:someTextField]  
forKey:@"NSFieldEditor"]];


Thanks; I had figured I could do this, and was actually in the process  
of writing this when you replied.  I was thinking Cocoa had a more  
"elegant" manner to do this, rather than having to do it manually, but  
it works, so I'm happy.


randy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Kyle Richter
There are also a handful of companies out there that are selling  
prebuilt generic PCs with Leopard preinstalled onto them (ie Prystar).  
In terms of fighting it with your software it might be best to let  
Apple worry about it, but you can most likely pull the system profiler  
information and compare it against known Apple branded information to  
see if the machine fits into a valid model.


Kyle

On Jul 30, 2008, at 11:06 AM, Abernathy, Joshua wrote:


Seeing as how the OS itself thinks it's running on Apple hardware, I
have no idea how you, running on the OS, would detect otherwise.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] On Behalf Of Devon Ferns
Sent: Wednesday, July 30, 2008 12:42 PM
To: Tim McGaughy
Cc: cocoa-dev@lists.apple.com
Subject: Re: Checking for hackintosh

Someone hacks the OS X kernel to bypass Apple's checks for a  
legitimate

Macintosh and usually posts it to some p2p site where people
steal(copyright infringe) it and run it on their home build PCs.

Devon

Tim McGaughy wrote:


On Jul 29, 2008, at 9:22 PM, John Joyce wrote:


Does anybody have a means or a tool for checking for hackintoshes?
I really don't approve of such things and would like to leave clever
messages on my own software if it is run on a hackintosh.


What's a hackintosh?

___

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

Please do not post 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/dferns%40devonferns.com


This email sent to [EMAIL PROTECTED]

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jabernathy%40burrislogi
stics.com

This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextFieldCell - Kidnapped Focus Ring!

2008-07-30 Thread Joel Norvell
Hi Seth,

My experience with focus rings has always been with NSView subclasses, not with 
cells.  And my focus rings have always been drawn outside their views, adorning 
them, as it were.  In the past, I have had to invalidate the focus ring's area 
with setKeyboardFocusRingNeedsDisplayInRect in order to to get them to draw, 
because I was doing something non-standard.  Also I've always used 
NSFocusRingTypeExterior.

Here's some code I've used to draw focus rings "by hand":

- (void) drawFocusRing
{
[NSGraphicsContext saveGraphicsState];

[[NSColor keyboardFocusIndicatorColor] set];

NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect:[self bounds]] fill];

[NSGraphicsContext restoreGraphicsState];
}

I doubt that this will be of much help, but since no one else has taken a shot 
at your question, I wanted "to keep the ball in the air," so to speak.

Sincerely,
Joel




  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for Hackintosh

2008-07-30 Thread Matt Burnett
The OP needs to get off his high horse and come to the realization  
that some people are a bit more clever than him (or Apple). But  
anyways you guys all forgot something big, virtualization. Can't OS X  
Server 10.5 be (legally) virtualized? Any hardware checks will either  
break in a virtualized environment, or a hackintosh will pretend to be  
virtualized, either way you lose. I bet the OP is the type of guy who  
thinks fighting piracy makes business sense too.


On Jul 30, 2008, at 1:34 PM, Scott Lahteine wrote:


Hi,

There are a couple of ways to definitively test for a hackintosh.  
You could look at the IO Registry for unusual hardware  
configurations. But as it happens, the latest Hackintosh kernels all  
use custom Machine Type strings. So you can test to see if it's one  
of the known Mac models, and if it isn't you can assume it's  
probably a Hackintosh.


Unfortunately, this breaks if future Macs introduce new Machine Type  
strings, which is almost certain. You'll notice I'm not testing for  
AppleTV, for example, because I don't happen to know its string.


The following is what I use in "TabletMagic" to detect a TabletPC :


- (BOOL)detectHackintosh
{
 SInt32 gestaltReturnValue;
 BOOL is_known_mac = NO;
 if (!Gestalt(gestaltUserVisibleMachineName, &gestaltReturnValue))
 {
   char *known_machines[] =  
{"AAPL","iMac","PowerBook","PowerMac","RackMac",

   "Macmini","MacPro","MacBookPro","MacBook"};
   StringPtr pmach = (StringPtr)gestaltReturnValue;
   int i, len = pmach[0];
   char *machine_string = (char*)malloc(len+2);
   strncpy(machine_string, (char*)&pmach[1], len+1);

   for (i=sizeof(known_machines)/sizeof(known_machines[0]); i--;)
 if (!strncmp(machine_string, known_machines[i],  
strlen(known_machines[i]))) { is_known_mac = YES; break; }


   free(machine_string);
 }

 if (is_known_mac)
 {
   // delete the tab having identifier "6"
   [ tabview removeTabViewItem: [ tabview tabViewItemAtIndex:  
[ tabview indexOfTabViewItemWithIdentifier: @"6" ] ] ];

 }

 return !is_known_mac;
}



--
 Scott Lahteine  Thinkyhead Software
 [EMAIL PROTECTED]http://www.thinkyhead.com/


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for Hackintosh

2008-07-30 Thread I. Savant

On Jul 30, 2008, at 8:06 PM, Matt Burnett wrote:

The OP needs to get off his high horse and come to the realization  
that some people are a bit more clever than him (or Apple).


  ... unnecessary and unproductive.

--
I.S.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Binding an NSMenu to an NSArrayController

2008-07-30 Thread Dave DeLong
Hi everyone,

I've got an NSArrayController that I'd like to use to populate an
NSMenu for use in an NSStatusItem.  Is there a way to do this with
bindings?

Thanks,

Dave
___

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

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

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

This email sent to [EMAIL PROTECTED]


Modal window won't go away when stopped

2008-07-30 Thread Randall Meadows

OK, here's an interesting one...

I invoke [NSApp runModalForWindow:confirmDeletionWdw] from an IBAction  
(call it MethodA) of a popup menu item displayed in a sheet.


That modal window has a button, in whose IBAction (call it MethodB) I  
call [NSApp stopModalWithCode:[sender tag]].


The modal loop ends, control returns to my MethodA (with the  
appropriate return code), and my app continues on.  However, the modal  
window is *still* displayed on screen.  It's no longer modal; I can  
click back in my original sheet, and interact with it, etc.  I can  
also still interact with the no-longer-modal modal window, and the  
buttons' actions are triggered.


I was under the impression that, having displayed and started a modal  
window loop with runModalForWindow:, that stopModalWithCode: would  
stop the modal loop and close (or at least hide) the window.  The docs  
say that "This method stops the loop only if it’s executed by code  
responding to an event", which I'm doing as part of the IBAction  
assigned to the button, no?


Any ideas on what I'm supposed to do to get this modal window to  
disappear when the modal loop is over?


Tank ewe!
randy

PS - In case anyone's wondering, I'm using the modal window because  
the action the user is about to do is being confirmed, in a very  
noticeable way, since the action is about to delete files.  I'm NOT  
using a sheet for this, since the action is already being requested  
*from* a sheet, and said sheet is *already* part of a *series* of  
sheets.  The modal window simply seemed the best route to go.___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: Modal window won't go away when stopped

2008-07-30 Thread Randall Meadows
Sorry for the noise...a clear indication has been given that I need to  
stop coding for today:


orderOut: is required to actually close the frickin' window...

Stick a fork in me...

On Jul 30, 2008, at 7:00 PM, Randall Meadows wrote:


OK, here's an interesting one...

I invoke [NSApp runModalForWindow:confirmDeletionWdw] from an  
IBAction (call it MethodA) of a popup menu item displayed in a sheet.


That modal window has a button, in whose IBAction (call it MethodB)  
I call [NSApp stopModalWithCode:[sender tag]].


The modal loop ends, control returns to my MethodA (with the  
appropriate return code), and my app continues on.  However, the  
modal window is *still* displayed on screen.  It's no longer modal;  
I can click back in my original sheet, and interact with it, etc.  I  
can also still interact with the no-longer-modal modal window, and  
the buttons' actions are triggered.


I was under the impression that, having displayed and started a  
modal window loop with runModalForWindow:, that stopModalWithCode:  
would stop the modal loop and close (or at least hide) the window.   
The docs say that "This method stops the loop only if it’s executed  
by code responding to an event", which I'm doing as part of the  
IBAction assigned to the button, no?


Any ideas on what I'm supposed to do to get this modal window to  
disappear when the modal loop is over?


Tank ewe!
randy

PS - In case anyone's wondering, I'm using the modal window because  
the action the user is about to do is being confirmed, in a very  
noticeable way, since the action is about to delete files.  I'm NOT  
using a sheet for this, since the action is already being requested  
*from* a sheet, and said sheet is *already* part of a *series* of  
sheets.  The modal window simply seemed the best route to go.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Triggering a notification?

2008-07-30 Thread Michael Ash
On Wed, Jul 30, 2008 at 6:22 PM, Randall Meadows <[EMAIL PROTECTED]> wrote:
> On Jul 30, 2008, at 3:43 PM, Nick Zitzmann wrote:
>
>> On Jul 30, 2008, at 3:31 PM, Randall Meadows wrote:
>>
>>> Grrr, seems like I should know this, or at least be able to find out, but
>>> so far, no good.
>>>
>>> What is the trick to triggering the controlTextDidChange: delegate
>>> method/notification when you set the text of a NSTextField (for instance)
>>> *programmatically*?
>>
>> You can just do this manually, like this: (warning - written in Mail,
>> untested, use at your own risk, and all that)
>>
>> [someTextField setStringValue:@"Hello world"];
>> [[NSNotificationCenter defaultCenter]
>> postNotificationName:NSControlTextDidChangeNotification object:someTextField
>> userInfo:[NSDictionary dictionaryWithObject:[[someTextField window]
>> fieldEditor:YES forObject:someTextField] forKey:@"NSFieldEditor"]];
>
> Thanks; I had figured I could do this, and was actually in the process of
> writing this when you replied.  I was thinking Cocoa had a more "elegant"
> manner to do this, rather than having to do it manually, but it works, so
> I'm happy.

The more elegant manner is to simply do whatever the notification
method does directly.

Generally notifications like this should be in response to user
actions. Triggering them in response to programmatic editing is
backwards. Generally changes should flow from the view to the model
when the user makes changes, and they should flow from the model to
the view when you make changes. So if you're changing the text field,
the guts that it edits should already have been updated before you
touched the field, requiring no further action.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Michael Ash
On Tue, Jul 29, 2008 at 10:22 PM, John Joyce
<[EMAIL PROTECTED]> wrote:
> Does anybody have a means or a tool for checking for hackintoshes?
> I really don't approve of such things and would like to leave clever
> messages on my own software if it is run on a hackintosh.

I really strongly advise against this.

Your code will have bugs, simply because it is code. It is quite
likely that one of these bugs will one day prevent a legitimate user
who owns a real, legitimate Macintosh from using your software.

At that point, I would argue, the harm to that one user far outweighs
any minor, undetectable gain you could possibly get from such a
scheme.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Chris Suter
On Thu, Jul 31, 2008 at 12:00 PM, Michael Ash <[EMAIL PROTECTED]> wrote:

> On Tue, Jul 29, 2008 at 10:22 PM, John Joyce
> <[EMAIL PROTECTED]> wrote:
> > Does anybody have a means or a tool for checking for hackintoshes?
> > I really don't approve of such things and would like to leave clever
> > messages on my own software if it is run on a hackintosh.
>
> I really strongly advise against this.
>
> Your code will have bugs, simply because it is code. It is quite
> likely that one of these bugs will one day prevent a legitimate user
> who owns a real, legitimate Macintosh from using your software.
>
> At that point, I would argue, the harm to that one user far outweighs
> any minor, undetectable gain you could possibly get from such a
> scheme.
>

One issue that we have is that we get a lot of support for our products from
people who are running our software on Hackintosh's and they aren't usually
up front about that fact. They end up wasting our time when it turns out the
problem they've got is because they're running on a Hackintosh. So there
would be some benefit if we could detect when we're running from a
Hackintosh. Unfortunately, as others have pointed out, there is no future
proof way of doing that at the moment (that I know of).

-- Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Matt Burnett
Then shouldn't you be able to determine if they are using a hackintosh  
by the descriptions of support requests they are submitting? If not  
are you sure your code checks return values and is designed to fail  
gracefully?


On Jul 30, 2008, at 9:27 PM, Chris Suter wrote:

On Thu, Jul 31, 2008 at 12:00 PM, Michael Ash  
<[EMAIL PROTECTED]> wrote:



On Tue, Jul 29, 2008 at 10:22 PM, John Joyce
<[EMAIL PROTECTED]> wrote:

Does anybody have a means or a tool for checking for hackintoshes?
I really don't approve of such things and would like to leave clever
messages on my own software if it is run on a hackintosh.


I really strongly advise against this.

Your code will have bugs, simply because it is code. It is quite
likely that one of these bugs will one day prevent a legitimate user
who owns a real, legitimate Macintosh from using your software.

At that point, I would argue, the harm to that one user far outweighs
any minor, undetectable gain you could possibly get from such a
scheme.



One issue that we have is that we get a lot of support for our  
products from
people who are running our software on Hackintosh's and they aren't  
usually
up front about that fact. They end up wasting our time when it turns  
out the
problem they've got is because they're running on a Hackintosh. So  
there

would be some benefit if we could detect when we're running from a
Hackintosh. Unfortunately, as others have pointed out, there is no  
future

proof way of doing that at the moment (that I know of).

-- Chris
___

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

Please do not post 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/matt.w.burnett%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Chris Suter
On Thu, Jul 31, 2008 at 1:00 PM, Matt Burnett <[EMAIL PROTECTED]>wrote:

> Then shouldn't you be able to determine if they are using a hackintosh by
> the descriptions of support requests they are submitting?


Sure, if customers are willing to disclose that they're running on a
Hackintosh which isn't usually the case.


> If not are you sure your code checks return values and is designed to fail
> gracefully?


Of course, but we don't support Hackintosh's so we don't test on them and
they are different (especially where disk utilities are concerned).

I was just making the point that it would be useful to be able to detect
whether you're running on a Hackintosh *if* there was a reliable way of
doing it.

-- Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Dustin Robert Kick
Why not have the error messages simply be error messages, and leave  
out the "clever" which I think is always a bad idea, anyway, in almost  
any domain?  Have it report an error that has a number indicating a  
possible hackintosh, and double check if it is a hackintosh issue, or  
a bug in your software.



Dustin  
KC9MEL  


On Jul 30, 2008, at 10:00 PM, Matt Burnett wrote:

Then shouldn't you be able to determine if they are using a  
hackintosh by the descriptions of support requests they are  
submitting? If not are you sure your code checks return values and  
is designed to fail gracefully?


On Jul 30, 2008, at 9:27 PM, Chris Suter wrote:

On Thu, Jul 31, 2008 at 12:00 PM, Michael Ash  
<[EMAIL PROTECTED]> wrote:



On Tue, Jul 29, 2008 at 10:22 PM, John Joyce
<[EMAIL PROTECTED]> wrote:

Does anybody have a means or a tool for checking for hackintoshes?
I really don't approve of such things and would like to leave  
clever

messages on my own software if it is run on a hackintosh.


I really strongly advise against this.

Your code will have bugs, simply because it is code. It is quite
likely that one of these bugs will one day prevent a legitimate user
who owns a real, legitimate Macintosh from using your software.

At that point, I would argue, the harm to that one user far  
outweighs

any minor, undetectable gain you could possibly get from such a
scheme.



One issue that we have is that we get a lot of support for our  
products from
people who are running our software on Hackintosh's and they aren't  
usually
up front about that fact. They end up wasting our time when it  
turns out the
problem they've got is because they're running on a Hackintosh. So  
there

would be some benefit if we could detect when we're running from a
Hackintosh. Unfortunately, as others have pointed out, there is no  
future

proof way of doing that at the moment (that I know of).

-- Chris
___

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

Please do not post 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/matt.w.burnett%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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


This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Checking for hackintosh

2008-07-30 Thread Dave DeLong
I'd just like to point out that since hackintoshes are not reliable
machines, it seems a bit odd to search for a reliable way to identify
them.

Dave

On Wed, Jul 30, 2008 at 9:24 PM, Chris Suter <[EMAIL PROTECTED]> wrote:
> I was just making the point that it would be useful to be able to detect
> whether you're running on a Hackintosh *if* there was a reliable way of
> doing it.
___

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

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

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

This email sent to [EMAIL PROTECTED]


[Moderator] Re: Checking for Hackintosh

2008-07-30 Thread CocoaDev Admins

this type of comment isn't productive or appropriate for the list.

scott [moderator]


On 30-Jul-08, at 8:06 PM, Matt Burnett wrote:

The OP needs to get off his high horse and come to the realization  
that some people are a bit more clever than him (or Apple). But  
anyways you guys all forgot something big, virtualization. Can't OS  
X Server 10.5 be (legally) virtualized? Any hardware checks will  
either break in a virtualized environment, or a hackintosh will  
pretend to be virtualized, either way you lose. I bet the OP is the  
type of guy who thinks fighting piracy makes business sense too.


___

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

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

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

This email sent to [EMAIL PROTECTED]


How to get the file path to my application

2008-07-30 Thread Randy Canegaly
If I have a Cocoa application named Fred, how do programmatically (in  
Fred's code) get the path to the directory where Fred.app is stored?


Thanks

___

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

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

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

This email sent to [EMAIL PROTECTED]


Document based initial window.

2008-07-30 Thread Chris Idou

In a Cocoa document based application, how do you stop it from initially 
opening an "empty" document on start up?

(I'm using a core data application if it matters).


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get the file path to my application

2008-07-30 Thread Ken Thomases

On Jul 30, 2008, at 11:21 PM, Randy Canegaly wrote:

If I have a Cocoa application named Fred, how do programmatically  
(in Fred's code) get the path to the directory where Fred.app is  
stored?


[[NSBundle mainBundle] bundlePath]

Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get the file path to my application

2008-07-30 Thread Bill Bumgarner

On Jul 30, 2008, at 9:21 PM, Randy Canegaly wrote:
If I have a Cocoa application named Fred, how do programmatically  
(in Fred's code) get the path to the directory where Fred.app is  
stored?


[[NSBundle mainBundle] bundlePath];

However, if you want to find stuff inside of your application, you  
should use mainBundle's -pathForResource:ofType: method (and its  
variants).


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: How to get the file path to my application

2008-07-30 Thread Preston Jackson

In general, NSBundle is a good resource for this.

Try:

NSString* applicationPath = [[NSBundle mainBundle] bundlePath];

This will tell you the path of the application bundle (Fred.app) and  
then you'll have to step up one element in the applicationPath to get  
the parent directory.


Preston

On Jul 30, 2008, at 10:21 PM, Randy Canegaly wrote:

If I have a Cocoa application named Fred, how do programmatically  
(in Fred's code) get the path to the directory where Fred.app is  
stored?


Thanks

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Document based initial window.

2008-07-30 Thread Bill Bumgarner

On Jul 30, 2008, at 9:22 PM, Chris Idou wrote:
In a Cocoa document based application, how do you stop it from  
initially opening an "empty" document on start up?


(I'm using a core data application if it matters).


Implement...

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender;

... and return NO.

This method goes on your application delegate.

b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Dragging a header file to XIB Dock

2008-07-30 Thread Jonathan Hess

Hey Nelson -

The only time you should have to drag a header file to IB is if that  
header is used by your project, doesn't come from the system, and is  
not in your project either. A header in a second project that your  
main project depends on would be an example of this. Otherwise, if  
you're just working with classed defined in your main/only project,  
you shouldn't have to drag any headers. Just grab an instance of the  
appropriate class (probably NSObject) from the Interface Builder  
Library, deposit it in your document, and set the custom class in the  
identity inspector.


Interface Builder automatically synchronizes all of your header files  
with Xcode -

Jon Hess

On Jul 29, 2008, at 7:39 PM, Nelson Hazeltine wrote:



I am new to IB and Cocoa.

When I drag and drop a header file containing interface information  
to the XIB dock, it doesn't work, i.e., nothing happens.  As near as  
I can tell, the header file is okay.  I am wanting to get the the  
object browser.


Any suggestions?
___

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

Please do not post 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/jhess%40apple.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Making child windows move with their parents

2008-07-30 Thread Sumner Trammell
Hi. In my WebKit-based app, there is an occasional popup window, and
I'm trying to make it so that when you move the main window around,
the popup moves as well.


Here is my typical, vanilla WebView delegate method. In it, new
windows are made visible:

- (void)webViewShow:(WebView *)aSender {
NSDocumentController *theDocumentController =
[NSDocumentController sharedDocumentController];
MyDocument *theDocument = [theDocumentController
documentForWindow:[aSender window]];
[theDocument showWindows];
}



I tried adding this just before the [theDocument showWindows] call:

- (void)addChildWindow:(NSWindow *)childWindow
ordered:(NSWindowOrderingMode)orderingMode


like so:

- (void)webViewShow:(WebView *)aSender {
NSDocumentController *theDocumentController =
[NSDocumentController sharedDocumentController];
MyDocument *theDocument = [theDocumentController
documentForWindow:[aSender window]];

[[self window] addChildWindow:[aSender window] ordered:NSWindowAbove];

[theDocument showWindows];
}




but it doesn't work.  I get *** -[MyDocument window]: unrecognized
selector sent to instance 0x1613ab30 in the run log.

aSender is the WebView in the main window.
self is the MyDocument object, and it has a window outlet that I can
see when I right-click the File's Owner in IB.



It seems to me that I want the new window to be made a child of the
current window. I obviously have something wrong, but I can't figure
out what.

I also tried:

[[[self webView] window] addChildWindow:[aSender window]
ordered:NSWindowAbove];


but that just crashes.




Thanks,
-s
___

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

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

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

This email sent to [EMAIL PROTECTED]


Bindings to simulate spreadsheet functions in NSTableView?

2008-07-30 Thread vince
thanks,
I have a tableView with two columns. Column one lists arbitrary input
numbers. Column two lists monetary (dollar) vales. I want to display the
total running sum of column one in a textField and the dynamic (total)
monetary value of column two in a separate textField at the bottom of the
application, much the same as a spreadsheet function.

Can I accomplish this using bindings? If not can someone explain?

thanks and sorry about the rudimentary question ...

v.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-30 Thread Andrew Merenbach

On Jul 30, 2008, at 8:24 PM, Chris Suter wrote:

On Thu, Jul 31, 2008 at 1:00 PM, Matt Burnett <[EMAIL PROTECTED] 
>wrote:


Then shouldn't you be able to determine if they are using a  
hackintosh by

the descriptions of support requests they are submitting?



Sure, if customers are willing to disclose that they're running on a
Hackintosh which isn't usually the case.


If not are you sure your code checks return values and is designed  
to fail

gracefully?



Of course, but we don't support Hackintosh's so we don't test on  
them and

they are different (especially where disk utilities are concerned).

I was just making the point that it would be useful to be able to  
detect
whether you're running on a Hackintosh *if* there was a reliable way  
of

doing it.

-- Chris



This thread, albeit only marginally-related to Cocoa, is an  
interesting one.  One solution (not saying that it'd "work" for  
everyone) would be to abandon Hackintosh-*checking* code, but install  
a menu item to send a system profile to you, via an online PHP form or  
some such, along with a support request message.  Thus one need not  
program in potentially-fragile code, but one does get to decide, per- 
support-request, whether a computer is legitimately a supported machine.


On the other hand, it might be possible for a clever user to hack your  
program and to send bogus information to your web form.  This would be  
Bad.  But such a system might at least be a deterrent to  
"Hackintoshers."


Cheers,
Andrew


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Making child windows move with their parents

2008-07-30 Thread Graham Cox

NSDocument doesn't implement -window

I think you're getting muddled about what "sender" is and the  
relationship between the document and other objects. Using  
addChildWindow: should be OK, once you've sorted this out.


hth,

Graham

On 31 Jul 2008, at 2:51 pm, Sumner Trammell wrote:


but it doesn't work.  I get *** -[MyDocument window]: unrecognized
selector sent to instance 0x1613ab30 in the run log.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Making child windows move with their parents

2008-07-30 Thread Jens Alfke


On 30 Jul '08, at 9:51 PM, Sumner Trammell wrote:


but it doesn't work.  I get *** -[MyDocument window]: unrecognized
selector sent to instance 0x1613ab30 in the run log.

aSender is the WebView in the main window.
self is the MyDocument object, and it has a window outlet that I can
see when I right-click the File's Owner in IB.


Look at your code. You tried to send -window to a MyDocument object,  
which is a subclass of NSDocument:


	[[self window] addChildWindow:[aSender window]  
ordered:NSWindowAbove];


There is no such method (because documents can have multiple windows,  
so there's no sensible result.)


You must have gotten a warning about this at compile time. *Do not  
ignore such warnings*. They should be treated as error messages  
because, nearly always, they indicate a situation that will throw an  
exception at runtime, causing your app to fail. I recommend turning on  
the "treat warnings as errors" build config checkbox.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Multithreaded file read

2008-07-30 Thread Jens Alfke


On 29 Jul '08, at 11:06 PM, Roger Herikstad wrote:


I have a cocoa program that will read these index files and
fetch the appropriate data from the big file, plot it and store as an
image. I would like to run these print operations in parallel, but I'm
concerned that a conflict will arise if two threads are reading into
the same file.


As long as each thread opens its own file descriptor, you'll be fine.  
Each descriptor has its own cursor. The thing you shouldn't do is  
share a single file descriptor between threads (unless you use the  
pread/pwrite API, which is stateless.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]