Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Ken Thomases
On Feb 22, 2014, at 1:44 AM, jonat...@mugginsoft.com wrote:

> On 22 Feb 2014, at 00:12, Ken Thomases  wrote:
> 
>> On Feb 21, 2014, at 3:17 PM, jonat...@mugginsoft.com wrote:
>> 
>>> So I want to be able to send the same message to any class and get an 
>>> appropriate void* pointer.
>> 
>> There's no one representation of its content, so there's no way for any 
>> recipient of a supposed "pointer to that content" (however that might be 
>> obtained) to interpret the pointer.
> Not so.
> The pointer is ultimately passed as a vararg along with a Mono method 
> representation as part of a Mono method invocation.
> The Mono method representation includes type info for its parameters.
> Hence it can cast and deference a void* pointer appropriately.

My point is not about the recipient.  It's about the NSNumber.  There's no one 
representation of an NSNumber's content.  Keep in mind that NSDecimalNumber 
is-a NSNumber.  Any Cocoa API which gives you an NSNumber may in fact be giving 
you an NSDecimalNumber.  It's not documented what the byte-wise value of an 
NSNumber is, so I can't see how your type info could allow you or Mono to 
dereference it.

> In the above if key is an NSNumber containing a 5 then  [key monoValue] 
> returns a pointer to a 5.

This betrays the flaw in your thinking.  There's no such thing as "a pointer to 
a 5"!  You can have a pointer to an int which contains the value 5.  Or a long 
which contains the value 5.  Or a char which contains the value 5.  Or, and 
this is the killer, a completely custom representation which only means "5" 
when interpreted by the NSNumber's own methods.  A pointer without the 
knowledge of which specific storage type it's pointing to is almost useless.  
Certainly, any recipient of that pointer could not reliably extract the value 5 
from it or compare it to any other pointer to see if they contain the same 
thing.

For example, what makes you think that two NSNumbers which compare equal have 
the same size and byte-wise representation (as output by -getValue:) as each 
other?  First, one may have been created with +numberWithChar: and the other 
with +numberWithUnsignedLongLong: and may have consequently used totally 
different internal storage for the value.  Second, there may be padding within 
the internal representation which is ignored by NSNumber's methods but which 
would make the data buffers unequal.

> If the key is an NSString then  [key monoValue] returns a pointer to a 
> monoObject representing the string.
> 
>> If you have some specific representation in mind, then don't use NSNumber.  
>> Use a custom class wrapping the specific representation you want to use.
> The custom class would simply be a dupe of NSNUmber + 1 method.
> My original category solution seems simpler. 

Other than being fatally flawed, sure.

The point of implementing your own class is that you would control the 
representation.  It's a reliable way to get meaningful pointers that anything 
knows how to interpret.  I wouldn't expect your custom class to be a total 
reimplementation of NSNumber because you probably don't need NSNumber's 
generality.  In fact, since you need Mono to interpret the pointed-to value, 
there's probably a limit to how general the class can be.

Regards,
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Jonathan Hull
Ken is right about the internal representation of NSNumber not being something 
you can count on (as it is a class cluster).  You should be able to count on 
the format of the data returned from its methods though (e.g. -integerValue, 
-floatValue).

Out of curiosity, are there any constraints on the numbers which will be used?  
If they are always integers, for instance, that makes the problem a lot easier. 
 In that case I would use the -integerValue of the number and store it in 
NSData as a previous commenter suggested.

If you need floating point values, then the entire problem becomes much harder, 
as using equality with floats is problematic in itself.

Thanks,
Jon

On Feb 22, 2014, at 12:32 AM, Ken Thomases  wrote:

>> In the above if key is an NSNumber containing a 5 then  [key monoValue] 
>> returns a pointer to a 5.
> 
> This betrays the flaw in your thinking.  There's no such thing as "a pointer 
> to a 5"!  You can have a pointer to an int which contains the value 5.  Or a 
> long which contains the value 5. Or a char which contains the value 5.  Or, 
> and this is the killer, a completely custom representation which only means 
> "5" when interpreted by the NSNumber's own methods.  A pointer without the 
> knowledge of which specific storage type it's pointing to is almost useless.  
> Certainly, any recipient of that pointer could not reliably extract the value 
> 5 from it or compare it to any other pointer to see if they contain the same 
> thing.
> 
> For example, what makes you think that two NSNumbers which compare equal have 
> the same size and byte-wise representation (as output by -getValue:) as each 
> other?  First, one may have been created with +numberWithChar: and the other 
> with +numberWithUnsignedLongLong: and may have consequently used totally 
> different internal storage for the value. Second, there may be padding within 
> the internal representation which is ignored by NSNumber's methods but which 
> would make the data buffers unequal.

___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread jonat...@mugginsoft.com
On 22 Feb 2014, at 08:32, Ken Thomases  wrote:

> There's no one representation of an NSNumber's content.
I think that this is the foundation of things.

What there is is a reported representation as given by -objCType.

The docs say, as I am sure you know:

“
NSNumber

objCType
Returns a C string containing the Objective-C type of the data contained in the 
receiver.

- (const char *)objCType
Return Value
A C string containing the Objective-C type of the data contained in the 
receiver, as encoded by the @encode() compiler directive.
“

Now I don’t care know how NSNumber persists its value nor with what type it was 
initialised. What I do care about in this case is what -objCType returns.
If I create a NSNumber like so:

NSNumber *n = @((int)5);

Then [n objCType] returns “i”.
From this I conclude that the canonical/reported representation is an int and I 
proceed accordingly.
And that’s all that I require.

The Mono method declares I need a pointer to an int.
If my Obj-C argument id object says, yes, I have a canonical/reported int and 
provide a pointer to such, then we are good to go.

I can define a complex number class.
MYComplexNumber * cn = [MYComplexNumber complexNumberWithString:@“5,2"];
This can return “i” for -objCType and that’s okay.
Now if I initialise it with @“5.5,2” -objCType may respond with “f”.
Now that is not okay. I have a unexpected type but this is something that I can 
detect and handle, likely by raising an exception.

> Keep in mind that NSDecimalNumber is-a NSNumber

Your point about NSNumber subclasses such as NSDecimaNumber is well made and a 
case in point.
It turns out that NSDecimaNumber returns “d” for double.
My category will produce a pointer to a double representation of the 
NSDecimaNumber.
And that’s okay.
NSDecimaNumber instances can safely(!!) be used as arguments to Mono methods 
that take a double parameter.

My actual working solution for decimals is to use an intermediate string 
representation to transfer data between Cocoa and the MONO CLR.

Your point is correct though and the class cluster nature of NSNumber makes 
things more interesting. 

#import 

int main(int argc, const char * argv[])
{
NSNumber *n = [NSNumber numberWithInt:5];
NSLog(@"[[NSNumber numberWithInt:5] objCType] = %s", [n objCType]);
NSLog(@"[@((int)5) objCType] = %s", [@((int)5) objCType]);
NSLog(@"[@((char)5) objCType] = %s", [@((char)5) objCType]);
NSLog(@"[@((float)5) objCType] = %s", [@((float)5) objCType]);

// from NSDecimalNumber.h
// - (const char *)objCType NS_RETURNS_INNER_POINTER;
// return 'd' for double
NSDecimalNumber *dn1 = [NSDecimalNumber decimalNumberWithString:@"1.0"];
NSLog(@"[dn1 objCType] = %s", [dn1 objCType]);

NSDecimalNumber *dn2 = [NSDecimalNumber decimalNumberWithMantissa:1 
exponent:0 isNegative:NO];
NSLog(@"[dn1 objCType] = %s", [dn2 objCType]);

// simple subclass detection fails on a class cluster
if ([[n class] isSubclassOfClass:[NSNumber class]]) NSLog(@"n has invalid 
subclass");
if ([[dn1 class] isSubclassOfClass:[NSNumber class]]) NSLog(@"dn1 has 
invalid subclass");

// direct subclass detection is okay
NSLog(@"dn1 class: %@", [dn1 class]);

return 0;
}

Regards

Jonathan


___

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

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

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

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

Re: Disabling screen capture

2014-02-22 Thread Brad O'Hearne
Sent from my iPad

> On Feb 22, 2014, at 12:27 AM, "Gary L. Wade"  
> wrote:
> 
> You did go to this page, right?
> 
> https://developer.apple.com/membercenter/index.action#requestTechSupport
Yep, that's the one.

> I remembered one form on the site, not this one, that I had to submit by 
> deleting all the data and doing it again. Some freaky web page issue; I think 
> it was a phone number field that kept trying to be reformatted but in a way 
> the back end didn't like it, so I turned off JavaScript while filling it in 
> and then submitted it. If things still don't work, try emailing 
> d...@apple.com and explain this issue and your real issue.

Yeah, I have a strong suspicion that there is a bug in the web page, and I'd 
lay money that it is due to the apostrophe in my last name. I deal with this 
problem continually -- web developers who script with single quotes don't allow 
for last names with a single quote (apostrophe) in them, and thus their string 
processing is abruptly terminated early and appears as if data wasn't sent, 
when it actually was. The "enter all required data" points pretty strongly to 
that being the case here. I'd guess I encounter this problem about half the 
time on web sites, and often just going and altering my last name to remove the 
apostrophe solves the problem. Unfortunately, it appears the you can't change 
your name in your Dev account profile anymore -- that requires contacting Dev 
program support as well. So I filled out yet another form for Dev program 
support, which luckily allowed me to submit. Hopefully we can get the problem 
ironed out quickly.

> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
> 
>>> On Feb 21, 2014, at 8:13 PM, Bradley O'Hearne  
>>> wrote:
>>> 
>>> On Feb 21, 2014, at 3:02 PM, Jens Alfke  wrote:
>>> 
>>> The best answer I’ve seen is that you’ll need to file a DTS support 
>>> incident and go through those official channels.
>> 
>> I’ve spent the last hour trying to post an issue to DTS via the Apple Mac 
>> Developer Program Member Center….no dice. Despite the fact I have all fields 
>> filled out, I keep getting the error message: 
>> 
>> “We are unable to process your request. Please enter all required data.”
>> 
>> If anyone has any insight how to get past this, let me know.
>> 
>> Thanks, 
>> 
>> Brad
>> 

___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Ken Thomases
On Feb 22, 2014, at 6:58 AM, jonat...@mugginsoft.com wrote:

> Now I don’t care know how NSNumber persists its value nor with what type it 
> was initialised. What I do care about in this case is what -objCType returns.
> If I create a NSNumber like so:
> 
> NSNumber *n = @((int)5);
> 
> Then [n objCType] returns “i”.

For the particular version of the framework you tested and with the particular 
value 5.  There's no guarantee that it will return that for any other version 
of the framework or all integer values.  In fact, since NSNumber can definitely 
support integer values that exceed the capacity of an int, it certain that for 
some integer values it won't return "i".  In fact, there may be ways of 
constructing an NSNumber whose value is 5 but which has a different -objCType, 
even in the same version of the framework.

> From this I conclude that the canonical/reported representation is an int and 
> I proceed accordingly.

"Reported", yes; "canonical", no.

> And that’s all that I require.

Except what if it's different?

> The Mono method declares I need a pointer to an int.
> If my Obj-C argument id object says, yes, I have a canonical/reported int and 
> provide a pointer to such, then we are good to go.
> 
> I can define a complex number class.
> MYComplexNumber * cn = [MYComplexNumber complexNumberWithString:@“5,2"];
> This can return “i” for -objCType and that’s okay.

Huh?  I don't follow.  I'm not sure why you're discussing a hypothetical class 
implementing -objCType.  It's not like that's a normal feature of classes.  I 
also don't understand how you expect a complex number to have a type which 
consists of a single integer.

> Now if I initialise it with @“5.5,2” -objCType may respond with “f”.

NSNumber is quite likely to return "f", too.

> Now that is not okay. I have a unexpected type but this is something that I 
> can detect and handle, likely by raising an exception.

I hope you're OK with that happening quite often.


>> Keep in mind that NSDecimalNumber is-a NSNumber
> 
> Your point about NSNumber subclasses such as NSDecimaNumber is well made and 
> a case in point.
> It turns out that NSDecimaNumber returns “d” for double.

NSDecimalNumber can represent values that are outside of the range of doubles.  
So, _some_ NSDecimalNumber instances _may_ return "d" for double, but others 
definitely won't.

Just to be clear, NSDecimalNumber is not the class uses to represent 
floating-point values, necessarily.  It's for representing numbers with very 
many significant digits and a large range of exponents.  Good old NSNumber is 
perfectly capable of representing float and double values, itself.

> My category will produce a pointer to a double representation of the 
> NSDecimaNumber.
> And that’s okay.
> NSDecimaNumber instances can safely(!!) be used as arguments to Mono methods 
> that take a double parameter.

Um, no.

Your whole approach is flawed because you believe that NSNumber is advertising 
a stable and reliable representation.  It isn't.  As ever, implementation 
details are private and subject to change.  Every instance of NSNumber is 
entitled to use a different representation.  Two NSNumbers which compare equal 
may not have the same representation.

Regards,
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread jonat...@mugginsoft.com

On 22 Feb 2014, at 14:27, Jonathan Hull  wrote:

> I think the main objection everyone has is that they believe (as did I) that 
> -getValue: is actually returning the internal representation of the object.

That is a very pertinent point that we haven’t mentioned.
-getValue: populates a pointer to a type matching -objCType.

Hence NSDecimal -getValue: populates a pointer to a double.

Jonathan



___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Ken Thomases
On Feb 22, 2014, at 9:33 AM, jonat...@mugginsoft.com wrote:

> On 22 Feb 2014, at 14:27, Jonathan Hull  wrote:
> 
>> I think the main objection everyone has is that they believe (as did I) that 
>> -getValue: is actually returning the internal representation of the object.
> 
> That is a very pertinent point that we haven’t mentioned.
> -getValue: populates a pointer to a type matching -objCType.

But there's no guarantee about what that type is.  There's no guarantee that 
it's a scalar rather than a structure, say.  There's no guarantee that a given 
class always uses the same type, even for the same logical value.

> Hence NSDecimal -getValue: populates a pointer to a double.

Not necessarily.  That's my point.

Regards,
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Jens Alfke
But there's already a fully functional ObjC<->C# bridge in Mono, isn’t there? I 
know that’s what MonoTouch for iOS is based on. Doesn’t it already handle 
bridging of NSDictionaries to C# Maps?

—Jens
___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Ken Thomases
On Feb 22, 2014, at 9:43 AM, Ken Thomases wrote:

> On Feb 22, 2014, at 9:33 AM, jonat...@mugginsoft.com wrote:
> 
>> -getValue: populates a pointer to a type matching -objCType.
> 
> But there's no guarantee about what that type is.  There's no guarantee that 
> it's a scalar rather than a structure, say.

Actually, I've just seen the note in the NSNumber docs that say there's a 
restricted set of types that its -objCType method is allowed to return and 
they're all scalar.  So, on that one point, I was wrong.

Regards,
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Disabling screen capture

2014-02-22 Thread Uli Kusterer
On 21 Feb 2014, at 22:26, Bradley O'Hearne  wrote:
> This is an app that the user has willfully installed, and has willfully 
> launched, fully knowing its function and purpose. The app does nothing until 
> the user launches it, the user can exit the app at any time, and no 
> restriction remains after the user exits the app. It is a completely 
> voluntary, user-inititiated launch of a temporary environment, which provides 
> the opportunity for the user to take an online test remotely. 

 So that means you don’t have to go through the app store? In that case, you 
could maybe disassemble DVD Player.app and check how that does it … ? The OS 
definitely has the feature in DVD Player, iTunes and QuickTime Player.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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

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

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

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

Re: Disabling screen capture

2014-02-22 Thread Uli Kusterer
On 21 Feb 2014, at 23:30, SevenBits  wrote:
> Well, yes, but Apple has the source code to OS X. There’s an important 
> difference in that users cannot simply just delete important OS components. 
> In some other operating systems (e.g Linux) everything works with packages 
> and you can simply uninstall packages that are not required, like web 
> browsers and networking capability.

 Last I checked, ProSoft sold an OS X boot disk containing a minimal OS X and 
Data Rescue+ on it. So at least some third parties are permitted to do 
something like that. It’s still all at Apple’s discretion, but it’s worth 
getting in touch with Apple and trying to get that, if it solves your problem.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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

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

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

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

Re: Disabling screen capture

2014-02-22 Thread Uli Kusterer
On 22 Feb 2014, at 00:56, Ron Hunsinger  wrote:
> Parental controls with a Simple Finder is pretty close to kiosk mode.

 Just using Mac OS X Kiosk mode would probably be even closer. :-) But judging 
from the login terminals at 1 Infinite Loop, Kiosk mode doesn’t turn off screen 
shots.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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

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

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

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

Re: Disabling screen capture

2014-02-22 Thread SevenBits
On Feb 22, 2014, at 12:28 PM, Uli Kusterer  wrote:

> On 21 Feb 2014, at 23:30, SevenBits  wrote:
>> Well, yes, but Apple has the source code to OS X. There’s an important 
>> difference in that users cannot simply just delete important OS components. 
>> In some other operating systems (e.g Linux) everything works with packages 
>> and you can simply uninstall packages that are not required, like web 
>> browsers and networking capability.
> 
> Last I checked, ProSoft sold an OS X boot disk containing a minimal OS X and 
> Data Rescue+ on it. So at least some third parties are permitted to do 
> something like that. It’s still all at Apple’s discretion, but it’s worth 
> getting in touch with Apple and trying to get that, if it solves your problem.

I’ve heard of that as well. They probably signed some sort of deal with Apple, 
like some companies have done with Microsoft to redistribute Windows’ files 
with third-party restoration DVDs.

> 
> Cheers,
> -- Uli Kusterer
> “The Witnesses of TeachText are everywhere...”
> http://zathras.de
> 



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread jonat...@mugginsoft.com
On 22 Feb 2014, at 16:55, Jens Alfke  wrote:

> But there's already a fully functional ObjC<->C# bridge in Mono, isn’t there? 
> I know that’s what MonoTouch for iOS is based on. Doesn’t it already handle 
> bridging of NSDictionaries to C# Maps?
> 

The MonoTouch bindings are from C# to Cocoa.
So they handle mapping C# structures to Cocoa ones, not the other way around, 
unfortunately.

Jonathan
___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Gary L. Wade
NSDecimal is a structure with associated C-level functions that could
theoretically work with the not-yet-supported floating point decimal types
in LLVM that were in later versions of GCC whereas NSDecimalNumber is an
Objective C class subclassed from NSNumber that provides NSDecimal
encapsulation.
--
Gary L. Wade
http://www.garywade.com/

On 2/22/2014 7:33 AM, "jonat...@mugginsoft.com" 
wrote:


>Hence NSDecimal -getValue: populates a pointer to a double.


___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread jonat...@mugginsoft.com
On 22 Feb 2014, at 15:32, Ken Thomases  wrote:
>> 
> 
> NSDecimalNumber can represent values that are outside of the range of 
> doubles.  So, _some_ NSDecimalNumber instances _may_ return "d" for double, 
> but others definitely won't.
> 
I don’t think so.
It is possible that this behaviour could change and yes my type hinting system 
would then break.
However, the current behaviour to me seems entirely self consistent.

The NSDecimalNumber header says:
- (const char *)objCType NS_RETURNS_INNER_POINTER;
// return 'd' for double

If you look in the GNUStep sources (just a vague hint I know, nothing more) 
then the -objCType return is hard coded.

NSDecimalNumber *maxd = [NSDecimalNumber maximumDecimalNumber] ;
NSDecimalNumber *mind = [NSDecimalNumber minimumDecimalNumber] ;

printf("Max double %e \n", DBL_MAX);

double dmax, dmin;
[maxd getValue:&dmax];
[mind getValue:&dmin];

NSLog(@"max decimal %@ encoding = %s %f", maxd, [maxd objCType], dmax); 
// d
NSLog(@"max decimal %@ encoding = %s %f", mind, [mind objCType], dmim); 
// d


All the best

Jonathan
___

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

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

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

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

Re: Disabling screen capture

2014-02-22 Thread Matt Gough
OK,

So lets assume that you can’t actually prevent the screen being captured. Maybe 
a solution would be to prevent that captured data from surviving very long.

e.g Install an FSEvents watcher and look out for image and movie files being 
created on the entire disk. Then delete them while your app is doing its 
testing.


M

On 22 Feb 2014, at 05:38, Bradley O'Hearne  wrote:

> 
> On Feb 21, 2014, at 9:43 PM, dangerwillrobinsondan...@gmail.com wrote:
>> They're pointing out valid security issues which are true on all platforms. 
> …
>> On any platform, you will need to basically install and run a root kit. 
> 
> This is not the case on Windows. It provides the ability to block certain 
> things which public API on OS X does not. We however would like to have an 
> app on OS X that provides the same capabilities as the app on Windows. It is 
> pretty much going to be a major fail if we have to tell large institutions 
> that their students cannot use their Macs for taking tests, because this one 
> hole that test providers want prevented is a trivial matter to block on 
> Windows, but cannot be done on OS X. One reason I’ve continued to pursue this 
> issue is that because it is hard for me to fathom that over the matter of 
> exposing knobs and switches in public API which I have good reason to believe 
> already exist in private API, that the preference would be to leave OS X as a 
> non-option for these kinds of use-cases. 
> 
>> \You can use the Quartz Display Services API to control the attached 
>> displays (see the "capture" functions for capturing control of the
> 
> Already using it. Capturing all displays allows us to display above other 
> apps, preventing other apps and other monitors from displaying other apps. It 
> does nothing to affect screen capture, screen recording, remote desktop, etc.
> 
>> It is impossible to verify a system is not compromised when the system is 
>> outside of physical control at any time prior to running or installing your 
>> app. 
> ...
>> If they've been convinced of anything else, either they've been lied to by 
>> others or they listened to people who really didn't understand security 
>> fundamentals.
> ...
>> If they're really aware of these issues, then they should have established 
>> guidelines on acceptable risks that are not severe enough to them to spend 
>> money on, redesign for, or spend time on. 
> 
> I appreciate the sentiment, and the thoughts about security theory and 
> philosophy. But no one has lied or misled anyone. The test content providers 
> have a very understandable request: just don’t allow test content to be 
> lifted quickly and en masse with minimal effort. Even Apple’s own engineers I 
> spoke to agreed this was reasonable. None of them attempted to position the 
> problem as being unsolvable, or unreasonable, or in violation of a deeper 
> security theory which needed to be explained to a CEO which just forked out 6 
> figures to have a high-quality industry certification exam created.
> 
>> At the end of the day though, on any platform, it is possible another 
>> process is running and recording the display stream, input stream, or 
>> network traffic or disk or memory writes before your process runs. 
> 
> Unless it is the Apple DVD player, which seems to secure its content just 
> fine. 
> 
>> You'd do well to analyze what processes could and should be running while 
>> yours runs and limit it to that as well. (Whitelisting)
>> A DTS incident might help you to find out what that might need to be. 
> 
> We’ve been doing this for years, and it is something we want to get away 
> from. It is a flawed approach on a number of levels, and a constant headache, 
> and also one that directly opposes the aims of sandboxing / Mac App Store. 
> 
> If it can be done in OS X…that’s an answer. If it cannot be done in OS 
> X….that’s also an answer. But telling the client they are unreasonable to 
> want to prevent their test content from being copied — not an answer. The 
> solution might not be immediately apparent or easy, but hey, that’s just new 
> a new problem to solve. 
> 
> B
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/devlists.mg%40googlemail.com
> 
> This email sent to devlists...@googlemail.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Application size growing

2014-02-22 Thread Damien Cooke
Hi All,
I write a video app for the auto industry basically, you shoot several short 
“segments” of your car and combine them then add a tune in the background.  I 
take them in 1280X720 and then resize them and add the audio using 
AVFoundation.  I store all the files I save into Documents/video and optionally 
save the final video to the photo roll.

After the user has uploaded the video they clear the cache (documents/videos) 
and move on to the next vehicle 

The problem is the app is gaining about 200Mb after each movie and the only 
cure is to delete the app. Where is this all going if I write all my stuff into 
one place and delete the directory later?  Does something I save into the photo 
roll count towards storage for my app?  IS AVFoundation using some caches or 
creating files in some temporary directory?

Anyone else seen anything like this?

Regards
Damien
___

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

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

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

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

Re: Application size growing

2014-02-22 Thread Jens Alfke

On Feb 22, 2014, at 2:07 PM, Damien Cooke  wrote:

> The problem is the app is gaining about 200Mb after each movie and the only 
> cure is to delete the app. Where is this all going if I write all my stuff 
> into one place and delete the directory later?

If this reproduces in the simulator, you can locate the app’s directory (buried 
way down in ~/Library) and examine the hierarchy to see where the 200MB is and 
what the file(s) look like. That should provide a clue.

If it only happens on a real device, you can write a bit of code to recursively 
iterate the directory tree and log the files and amount of space.

—Jens

___

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

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

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

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

Re: NSNumber : method to return pointer to represented value

2014-02-22 Thread Graham Cox

On 22 Feb 2014, at 11:58 pm, jonat...@mugginsoft.com wrote:

>> There's no one representation of an NSNumber's content.
> I think that this is the foundation of things.
> 
> What there is is a reported representation as given by -objCType.


NSNumber's can be slippery buggers, in my experience.

Why are you so determined that you must use NSNumber, rather than your own 
class? You haven't adequately explained why that isn't a good solution, as it 
certainly sounds as if it would be, and cut through all the uncertainty and bad 
fit of NSNumber for this purpose.

--Graham



___

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

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

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

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

Re: Application size growing

2014-02-22 Thread Roland King

On 23 Feb, 2014, at 7:19 am, Jens Alfke  wrote:

> 
> On Feb 22, 2014, at 2:07 PM, Damien Cooke  wrote:
> 
>> The problem is the app is gaining about 200Mb after each movie and the only 
>> cure is to delete the app. Where is this all going if I write all my stuff 
>> into one place and delete the directory later?
> 
> If this reproduces in the simulator, you can locate the app’s directory 
> (buried way down in ~/Library) and examine the hierarchy to see where the 
> 200MB is and what the file(s) look like. That should provide a clue.
> 
> If it only happens on a real device, you can write a bit of code to 
> recursively iterate the directory tree and log the files and amount of space.


Or use the Devices Explorer in Xcode for a development version of the app and 
dump the contents of the app directory, or iExplorer which does a remarkably 
good job of inspecting most things on a real device (without jailbreaking 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

6.1.6 for iPhones?

2014-02-22 Thread Rick Mann
There's an update to iOS 6.1 for iPod Touch 4th gen and iPhone 3GS, but none 
for other devices?

http://support.apple.com/kb/DL1722

I haven't yet updated my phone (although I've updated my iPads), and really 
don't want to.

-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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

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

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

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

Re: Disabling screen capture

2014-02-22 Thread Scott Ribe
On Feb 22, 2014, at 10:31 AM, Uli Kusterer  wrote:

> Just using Mac OS X Kiosk mode would probably be even closer. :-) But judging 
> from the login terminals at 1 Infinite Loop, Kiosk mode doesn’t turn off 
> screen shots.

I feel dirty for saying this ;-) But if you can't disable screen shots, how 
about: using fsevents to watch for the files to be created, and delete them. 
(Or, in this case raise a big fat alarm so the proctor will know.)

I know, pure evil ;-)


-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

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

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

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

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

Re: Disabling screen capture

2014-02-22 Thread dangerwillrobinsondanger



> On 2014/02/23, at 13:35, Scott Ribe  wrote:
> 
> I feel dirty for saying this ;-) But if you can't disable screen shots, how 
> about: using fsevents to watch for the files to be created, and delete them. 
> (Or, in this case raise a big fat alarm so the proctor will know.)
> 
> I know, pure evil ;-)
> 
> 
> -- 
> Scott Ribe
How would you know what files to watch for?
File extensions are really unreliable means of knowing content types. 

At the end of the day, BYOD for this is like a take home test where you take a 
proctor with you. Regardless of platform. 
You simply cannot create a controlled environment in an environment you don't 
control. 
This kind of testing is done in a controlled facility for that reason. 

No platform consumers use meets this criteria even if somebody thinks it does. 

There is no Cocoa to this. This is OT. 
Thread should 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: 6.1.6 for iPhones?

2014-02-22 Thread Maxthon Chan
No.

Either they are like iPhone 3G or iPad 1 which has been thrown off the iOS 6 
train on the first place, or they are like iPhone 4 and iPad 2 get carried over 
to iOS 7.

On Feb 23, 2014, at 10:58, Rick Mann  wrote:

> There's an update to iOS 6.1 for iPod Touch 4th gen and iPhone 3GS, but none 
> for other devices?
> 
>   http://support.apple.com/kb/DL1722
> 
> I haven't yet updated my phone (although I've updated my iPads), and really 
> don't want to.
> 
> -- 
> Rick
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/xcvista%40me.com
> 
> This email sent to xcvi...@me.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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

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

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

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

OpenCL with gcl buffer handling

2014-02-22 Thread Gerriet M. Denkmann

//  the host has a (big) malloced hostArray, on which OpenCl should work.

- (void)makeBufferOfSize: (size_t)arraySize  from: (void *)hostArray
{
_clArray = clCreateBuffer( context, CL_MEM_READ_WRITE | 
CL_MEM_USE_HOST_PTR, arraySize, hostArray, NULL );  
_hostArray = hostArray;
}

for(;;)
{
//  the host tells OpenCL to run a kernel which modifies _clArray 

//  then the host needs some of the data which OpenCL has modified:

- (void)theHostWantsDataFrom: (NSUInteger)sta  to: (NSUInteger)end
{
clEnqueueReadBuffer( commands, _clArray, CL_TRUE, sta, end - 
sta, _hostArray + sta, 0, NULL, NULL );
}
}

This works fine. clEnqueueReadBuffer is a no-op for DEVICE_HOST_UNIFIED_MEMORY 
and is reasonably fast else (i.e. for an external GPU).


But now for an exercise in gcl:

- (void)makeBufferOfSize: (size_t)arraySize  from: (void *)hostArray
{
_clArray = gcl_malloc( arraySize, hostArray, CL_MEM_READ_WRITE | 
CL_MEM_USE_HOST_PTR );
_hostArray = hostArray;
}

- (void)theHostWantsDataFrom: (NSUInteger)sta  to: (NSUInteger)end
{
if ( DEVICE_HOST_UNIFIED_MEMORY )
{
//  nothing needs to be done here; just wait till all work 
has been done
dispatch_group_wait( group, DISPATCH_TIME_FOREVER );
}
else//  very bad code here
{
NSUInteger bytesToCopy = end - sta;
uint8 *tempBuff = malloc( bytesToCopy );
dispatch_sync( queue, ^void{ gcl_memcpy( tempBuff, _clArray + 
sta, bytesToCopy ); } );
memcpy( _hostArray + sta, tempBuff, bytesToCopy ); // (BAD)
free( tempBuff );
};
}

This works, but the double copy at (BAD) does not look very efficient.
There clearly must be a better way. But how?

Gerriet.


___

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

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

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

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