Where to find updates for deprecated functions? - objective-c

Xcode4 will tell you if a function is deprecated but does not provide any info on what to use as the latest update for that function. What is the best way to find out the updated version of any deprecated function?

I always search the documentation with the function name and get the new version of the old methods. It works all the time.

There is a drop down(Doc Set) to select the libraries you want to search, in the Documentation window

Related

How to be compatible with like syntax after upgrading Hibernate Search 6.x version

I recently upgraded hibernate search from version 5.x to version 6.x, and encountered some problems. Most grammars can be processed by referring to the document, but there is a like grammar that cannot be processed directly. The official document also gives a description, However, the content of the document is not detailed enough and cannot be completed.
This is my syntax for 5.x version queryBuilder.moreLikeThis().comparingFields("name").toEntity(product).createQuery()
But I want to use the 6.x version and I don't know how to transform it for the time being
Hope someone who knows can answer, thanks!
As explained in the migration guide, the moreLikeThis predicate doesn't exist anymore in Hibernate Search 6.
But if it's just about a single field, you didn't really need the moreLikeThis predicate to begin with.
This should return the same results as your current code:
SearchSession session = Search.session(entityManager);
List<Product> hits = session.search(Product.class)
.where(f -> f.match().field("name").matching(product.getName()))
.fetchHits(20);

Geo.Lua function GEOMETRYFILTER and Redis

I'm trying to figure out how to actually do a call to GEOMETRYFILTER function in geo.lua since documentation is not very clear to me:
https://github.com/RedisLabs/geo.lua#GEOMETRYFILTER
What exactly do these parameters means and how do I call this function from Redis-cli? I was not able to find any example on google.
geo.lua's author here - IIRC it involves first creating a polyhash to describe the filter and then providing it along with the geoset to the library. Performance is quite horrible as everything is done in Lua.
FYI - that library is no longer maintained.

Check if method is deprecated

Is there any possibility to programmatically detect if a particular method is deprecated in the current version of system? Thanks
No, there is no any way to programmatically detect if a particular method is deprecated in the current version of system. The only thing you can get to know through warning message that your method is deprecated.
warnings are based on your deployment target.
set the Deployment Target to the latest version.
Do a build from the Product menu, see all the warnings.
You (and others getting here) may be trying to ask a slightly different question - how can you check to see if a deprecated method (aMethod:) of a non deprecated class (aClass) is still available at runtime? You can do that with:
if([aClass instancesRespondToSelector:#selector(aMethod:)]){
// it's still available for use
}

How to use CUTThread in CUDA

I am trying to run my own multi-gpu example, and I am following the NVIDIA's example. However, I cannot find where CUTThread is defined and then the compiler says:
error: ‘CUTThread’ was not declared in this scope
The short answer is 'dont use cutThread at all'. It comes from the SDK, not the toolkit, and it not intended for general use - NVIDIA don't document any of these function, nor do they guarantee that they either work, or won't change in definition or function from release to release. If you are interested in multiGPU computing, have a look at this answer to a very recent Stackoverflow question.

How do I find solutions for deprecated code?

I'm new to Mac programming. When I open sample projects, I often get 'deprecated' code warnings during a build. I'd like to fix these and get a clean build using XCode 4.
When Apple deprecates something, how do I find out why it was deprecated?
More importantly, how do I find out what is the 'new' correct way to implement the deprecated task?
For example, I'm seeing deprecation warnings for: QTMovieSizeDidChangeNotification, writeWithBackupToFile, documentForFileName, shouldCreateUI, setShowPanels, QTMovieCurrentSizeAttribute, and many others.
Look up the method in the documentation - they show the deprecated methods and tell you what the preferred methods are.
For example writeWithBackupToFile is clearly marked as deprecated and shows that writeSafelyToURL:ofType:forSaveOperation:error: should be used instead.
Same with shouldCreateUI which shows that either openUntitledDocumentAndDisplay:error: or openDocumentWithContentsOfURL:display:error: should be used instead.
Also, read the other methods in the documentation - you'll find things that do what you need. For example you list QTMovieSizeDidChangeNotification as being deprecated (in QuickTime 7.6.3). Right above it in the documentation you can see QTMovieNaturalSizeDidChangeNotification which has been available since QuickTime 7.6.3). Use that instead.
Look for the deprecated things in the documentation. Usually, there's a note that suggests what to use instead.
For example, the documentation for writeWithBackupToFile:ofType:saveOperation: says:
This method is called by action methods to save document contents to a file. (Deprecated in Mac OS X v10.4. Use writeSafelyToURL:ofType:forSaveOperation:error: instead.)
Search the documentation for that method/function/constant. It should list there what to use instead, or at least bring up a class that obviously has other methods that do something similar.