Is AVMetadataFaceObject available in OS X 10.10 or not? - macos

I'm desperately trying to learn and implement the AVCaptureMetadataOutput object type which Apple has documentation for here:
But you can see that on that page all of the code types are crossed out, saying they're only available in OS X 10.9. But that method seems like it is a pre-requisite for implementing AVMetadataFaceObject which is only available in OS X 10.10 - per this page:
I'm very confused and don't know why they (Apple) would introduce a new feature but require a method which has been depreciated for it to work.
Now my code is just throwing out "not available on OS X" errors and I don't know where to turn. Have I completely missed something and can anyone help?
Quoting OP in comment:
"also sorry for calling things the wrong names - perhaps when I'm typing like this I should just call things "things" rather than randomly guessing at "object" "type" "method" etc."

Use Core Image’s CIDetector and CIQRCodeFeature classes. They’ll find and decode the information and even correct for rotation and perspective issues.
(Source)

Related

CBService/CBCharacteristic UUIDString returns nil

I have an iOS app that generates a new UUID when it's going to talk for the first time with my OSX app, which is then stored, this way I can have different characteristics identifiers for different devices.
After calling
peripheral.discoverCharacteristics([], forService: service as CBService)
in the "didDiscoverServices" method in the OSX app, in "didDiscoverCharacteristicsForService" I do this to try to find out what the new device's UUID is, so that I check if they've talked before, if not, I will store it:
for characteristic in service.characteristics {
println("\(characteristic.UUIDString)")
}
The problem is that it prints nil, if I use characteristic.UUID instead, it gives me "Unknown (<46c35c38 c4994106 b6d351c9 8d900368>)" which is not the format I want to deal with.
Any idea why?
Another thing I've noticed is that, after testing what I've explained repeatedly with LightBlue to see what my app is advertising, sometimes certain services/characteristics seem to get stuck and just won't go away, I've even had to restore my phone to get rid of them once. Is this normal?
Thanks a lot
It seems that the documentation for CBUUID is incorrect. Although it references the UUIDString method, as you pointed out in your comments this gives an unrecognised selector exception.
I tried both Swift and Objective C code.
The CBUUID that is returned from a CBMutableCharacteristic does respond to the UUIDString selector, but obviously you don't get CBMutableCharacteristics from the discovery process.
As a design note, your approach probably isn't the most efficient. It would probably be better to have a known characteristic that contains an identifier (such as identifierForVendor) and then you can use the contents of the characteristic itself rather than the identifier of the characteristic to determine if this is a new device or not.
This way you can send the list of desired characteristics to discoverCharacteristics and write more "defined" code, rather than having to assume that the "unknown" characteristic is the identifier.

Has anyone gotten lldb expression evaluation to work with C++11 on Mavericks?

I've been trying for weeks now to get lldb working with C++11 on Mavericks, and I just cannot get it working reliably. Has anyone managed this? What exact steps did you take?
Symptoms I find include:
(1) Unable to invoke basic std functions, like if I have a vector v in the code, I cannot call "v.size()" (earlier StackOverflow responses agreed with this).
(2) Generally gets confused all the time about data types and classes. Sometimes it understands simple things, sometimes it just gives odd error messages, and misinterprets user types.
(3) If I stop the code and call a bunch of other functions, lldb sometimes just gets very confused, and I have seen utterly bizarre run-time behavior (e.g., I call a function from lldb and get logically impossible results, as if the call stack or memory was somehow mangled).
(4) Sometimes lldb just gives up and seems to lose track of where it is on the stack.
I know these are vague, but has anyone used lldb extensively for expression evaluation (not just breakpoints, but calling functions and methods from with debugger) and had lldb work? I have these very complex, very large datastructures and need an interactive debugger to manipulate them, and invoke methods on them, interactively (i.e., a repl).
Not part of the question, but if anyone knows of a true C++11 debugger that can call methods and evaluate functions at run time interactively, and works reliably on MacOS Mavericks, I'd be very grateful.
N.B. earlier MacOS versions are entirely different from Mavericks.
I don't know about 2-4, they are not specific enough to really tell. But #1 turns out to be a problem with the new C++ standard library on OS X. It is pretty aggressive about inlining most of the std::* functions, and not creating out of line copies. That's actually usually exactly what you want, but it is inconvenient for debugging!
You usually see errors like:
(lldb) expr my_vec.size()
error: call to a function 'std::__1::vector<int, std::__1::allocator<int> >::size() const' ('_ZNKSt3__16vectorIiNS_9allocatorIiEEE4sizeEv') that is not present in the target
And that's because there is no function to call, there's only inlined versions sprinkled through-out your code.
In C++11 you can work around this if you know in advance you will want to call functions in some particular template class by putting:
template class std::vector<int>;
for instance, in you code somewhere. Probably want to do this inside some kind of #ifdef DEBUG construct, you wouldn't want to ship code this way.

On the use of of Internal`Bag, and any official documentation?

(Mathematica version: 8.0.4)
lst = Names["Internal`*"];
Length[lst]
Pick[lst, StringMatchQ[lst, "*Bag*"]]
gives
293
{"Internal`Bag", "Internal`BagLength", "Internal`BagPart", "Internal`StuffBag"}
The Mathematica guidebook for programming By Michael Trott, page 494 says on the Internal context
"But similar to Experimental` context, no guarantee exists that the behavior and syntax of the functions will still be available in later versions of Mathematica"
Also, here is a mention of Bag functions:
Implementing a Quadtree in Mathematica
But since I've seen number of Mathematica experts here suggest Internal`Bag functions and use them themselves, I am assuming it would be sort of safe to use them in actual code? and if so, I have the following question:
Where can I find a more official description of these functions (the API, etc..) like one finds in documenation center? There is nothing now about them now
??Internal`Bag
Internal`Bag
Attributes[Internal`Bag]={Protected}
If I am to start using them, I find it hard to learn about new functions by just looking at some examples and trial and error to see what they do. I wonder if someone here might have a more complete and self contained document on the use of these, describe the API and such more than what is out there already or a link to such place.
The Internal context is exactly what its name says: Meant for internal use by Wolfram developers.
This means, among other things, the following things hold about anything you might find in there:
You most likely won't be able to find any official documentation on it, as it's not meant to be used by the public.
It's not necessarily as robust about invalid arguments. (Crashing the kernel can easily happen on some of them.)
The API may change without notice.
The function may disappear completely without notice.
Now, in practice some of them may be reasonably stable, but I would strongly advise you to steer away from them. Using undocumented APIs can easily leave you in for a lot of pain and a nasty surprise in the future.

Load package in Scheme48, how to get first, word variable, etc

I just installed the scheme48 package from macports and have started experiencing. I was watching this youtube video, link here and was attempting to perform some of the examples. In the lecture the professor is running scheme on a Sun terminal. For example, I attempt to do '(first 473)' and get 'Error: undefined variable first'. Now, I'm assuming I haven't loaded the correct package / library or what ever it is called in scheme but am not sure what the syntax and library is. I believe that scheme48 and the scheme version on that sun terminal in the video are not the same and could be part of the problem.
So, what library do I need to use and how do I load it?
Those lecture notes are based on a book called Simply Scheme, and you can find the library code that is used in the book here. Specifically, you need simply.scm.
(But whether it is a good idea to have these kind of overloading functions is debatable. Specifically, note that first is used in a way that is different from many other languages.)

Alternative to poseAsClass in Mac OS X 10.5 and higher?

Apple has deprecated NSObject's poseAsClass: method for OS X v10.5 and above. Is there another way to make class posing work?
I don't think there is a class-level equivalent, but you can exchange the implementation of two methods, which was often the purpose of using poseAsClass: (of course, you can exchange more than one method if you need to override multiple methods in a class). You want method_exchangeImplementations in the Objective-C 2.0 runtime (#import objc/runtime.h). A word of warning: after calling method_exchangeImplementations, calling the 'new' method actually calls the original method definition.
Lap Cat gives an alternative.
What are you trying to do? There are often ways around posing. I will concede, though, that it is sometimes the only way :)

Resources