azure cosmos changefeed estimator in java - java

I'm trying to implement changefeed estimator in java. But having a hard time finding api for that. Wondering if anyone has a sample of it. Here is the link to the .net implementation of what I'm looking for https://learn.microsoft.com/bs-latn-ba/azure/cosmos-db/how-to-use-change-feed-estimator

There is the source code Azure/azure-cosmos-dotnet-v3/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeed/Program.cs of sample code of the offical docuemnt Use the change feed estimator.
And there is the sample code for ChangeFeedProcess in Java Azure/azure-cosmosdb-java/.../examples/ChangeFeed/SampleChangeFeedProcessor.java.
The difference is that there is not a function GetChangeFeedEstimatorBuilder of class Container in Azure Cosmos Java SDK, but it seems that the C# implementation for GetChangeFeedEstimatorBuilder also to generate a ChangeFeedProcess instance, so I think you can refer to the C# code to write your Java one.
Here is the related C# source code as references for you.
https://github.com/Azure/azure-cosmos-dotnet-v3/blob/36444e8914f7224535e7b4ab819d748b66333aa1/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerCore.Items.cs#L388
https://github.com/Azure/azure-cosmos-dotnet-v3/blob/36444e8914f7224535e7b4ab819d748b66333aa1/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerCore.Items.cs#L411
https://github.com/Azure/azure-cosmos-dotnet-v3/blob/6f610954032d913eef13727669d0b7e0f061116c/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorCore.cs

Related

Example of DataStore Android in Java

Need to implement DataStore to my android project in java.
I'm following this document:
https://developer.android.com/topic/libraries/architecture/datastore?hl=pt-br#java
but is not working.
I can only find examples in Kotlin.
Can someone show me a simple example of using DataStore Preferences in java?
Thanks!!!
As I saw there no example present in java for dataStore so what you can do just go through this codelab which is in kotlin mean to follow the step but use java instead of kotlin, I hope this will help you.
DataStore Example: https://developer.android.com/codelabs/android-preferences-datastore#7
Use above link to learn dataStore and use below to convert kotlin code of data Store in java by using RxJava
java link: https://developer.android.com/topic/libraries/architecture/datastore?gclsrc=aw.ds&&gclid=Cj0KCQjwp86EBhD7ARIsAFkgakg-4Xc0UsX_xgNZmeSeNdZfTuoMoZ4JPUuZUyJq7dUOAV_JSY029GoaAgCHEALw_wcB#preferences-create

Tensorflow Java API - sophisticated example

I have already asked the question as a github issue, but was redirected to here. I have seen the example for importing model created and trained in Python imported into Java code and used for predictions. However, I had some problems understanding what was actually going on especially in this block and the GraphBuilder class declaration between lines 156-207. Could someone please give some explanation for them?
Moreover, I know the Java API is still under construction. However, I would be interested in if it is possible to see some more sophisticated examples, if it is possible including:
importing model into Java and then performing training on the model
implementing, training, evaluating, saving, loading a model from scratch in Java with Tensorflow
Does anyone have such an example, and willing to share it?
Thank you for any help!
Cheers,
Peter
The code block you pointed to generates a TensorFlow graph to "normalize" an image so that the image can be fed into the other TensorFlow graph (inception). It is achieving the equivalent of something like this in Python:
image = tf.cast(tf.image.decode_jpeg(input, channels = 3), tf.float32)
batch = tf.expand_dims(image, 0);
resized = tf.image.resize_bilinear(dims_expander, [input_height, input_width])
normalized = tf.divide(tf.subtract(resized, [input_mean]), [input_std])
Many of the Python functions for executing TensorFlow operations (like tf.cast, tf.image.decode_jpeg etc.) are generated from the TensorFlow op definitions. However, such generated functions do not exist yet in the Java API so the operations have to be constructed from lower level primitives, which is what the GraphBuilder class is doing.
Hope that helps.
Your other questions seem too broad, so not sure how to answer them here.
Hi I've created a sample application with TensorFlow Java API approximately a month ago. I've used a YOLOv2 model in the example. You can access it here: https://github.com/szaza/tensorflow-example-java.
I've also created a client-server architecture with Spring and Gradle, please see more details here: https://github.com/szaza/tensorflow-java-examples-spring.
I deployed it to my Google Cloud, so a live demo is also available here: http://35.229.93.105:8080/
More info about the project can be found here: https://sites.google.com/view/tensorflow-example-java-api

AWS ElasticSearchService - Java SDK example?

I am using the ElasticsearchService from Amazon. I am a little overwhelmed by their documentation. I find it vast but ever so difficult to navigate. Anyway, I am looking for an example of using the ESService using their AWS Java SDK. Do you have a link - or some code to insert a document?
I am actually using it from Scala, and what I've got so far is:
val awsEsClient: AWSElasticsearchClient = new AWSElasticsearchClient()
awsEsClient.setRegion(Region.getRegion(Regions.EU_CENTRAL_1))
awsEsClient.setEndpoint("es.eu-central-1.amazon.aws.com")
val createD = new CreateElasticsearchDomainRequest()
Where should I specify my own instance ARN? The uri that looks like
arn:aws:es:eu-central-1:xxxxxxxxxxx:domain/yyyyyyyy
Also, when using their SDK, I guess I don't need to specify anywhere the endpoint they provide? The one that goes by
search-yyyyyy-xxxxxxxxxx.eu-central-1.es.amazonaws.com
Or maybe this is what I should specify instead of the
awsEsClient.setEndpoint("es.eu-central-1.amazon.aws.com")
Thank you for your help and sorry if all these questions sound obvious.
So, I got the whole thing wrong from the beginning. The SDK is useful only in order to manage the service, like spin up new nodes and similar -- not to access it. For that, the only solution that Amazon offers is an HTTP endpoint, using the common REST api offered by Elastic Search.
The problem that came next was to authenticate the requests. I have compiled a scala library to do that for every request, which is available here: https://github.com/ticofab/aws-request-signer.

Podio API, attaching files to items

I have a problem with attaching a file to a specific item using Java API. I know it should be possible as this functionality described here in the Podio documentation https://developers.podio.com/doc/files/attach-file-22518 and examples for PHP and Ruby are given. However I cannot find such method in the podio java library. I could find in FileAPI just methods that provide uploading files, but not attaching them to specific objects as described in documentation.
I use Podio APi version 0.7.1
Any ideas how it should be done in Java?
Podio uses a REST-Style API. You send standard http-request, and you get back json-formatted data. So you can do it all without a special library for your programming language.
If there is no predefined java class for you, you can just do the call yourself. In the end it is just a HTTP-call.
From the ruby implemention, I see that you attach the file as multipart/form-data,
so it is the same a browser would do it. There should be http-handling java classes to help you.
You also need to add the information from the API-Page, like the POST-Parameters and of course the url. The most difficult part is probably the authentication headers, but you need to solve this problem only once.

Using Obj-C class from Java, is there a way?

I'm working on a project that requires me to run this code in java, but for a brief part of the code I want to access a class that is written in Objective-C. I want to pass parameters through the class then retrieve the data back into my Java file.
So to try to explain it clearer. My Java code needs to be able to access an Objective C file and retrieve data that I can implement in Java. My current IDE is eclipse, because I need to do this for android. Is there any possible way to make this work?
You can use Rococoa, http://code.google.com/p/rococoa/, or you can use JNI
Here is a similar question with answer: Wrapping an existing application with JNI
Have a look at JIGS, the Java Interface to GNUStep. http://www.gnustep.it/jigs/

Categories