Skip to content

Instantly share code, notes, and snippets.

Andreas Jakl andijakl

Block or report user

Report or block andijakl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
andijakl /
Created May 7, 2019
Creating an Anchor with ARCore for Amazon Sumerian
public void registerAnchor(final String requestId, final float[] matrix) {
if (requestId == null || matrix == null) {
mSurfaceView.queueEvent(new Runnable() {
public void run() {
Pose anchorPose = Pose.makeTranslation(matrix[12], matrix[13], matrix[14]);
andijakl / elephant.json
Created Mar 20, 2019
Analysis results of an image performed by the Microsoft Cognitive Services.
View elephant.json
"categories": [],
"adult": {
"isAdultContent": false,
"isRacyContent": false,
"adultScore": 0.026461338624358177,
"racyScore": 0.04174456745386124
"color": {
"dominantColorForeground": "Grey",
andijakl / imageAnalysis.js
Created Mar 20, 2019
Call to the Azure Cognitive Services Computer Vision API from JavaScript
View imageAnalysis.js
// TODO: if needed, adapt the URL to the region where you created the service
url: "" + $.param(params),
beforeSend: function(xhrObj){
// Request the output formatted as JSON
// Send the subscription key as part of the header
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key", subscriptionKey);
// Data is submitted to the server through a POST request
andijakl / imageAnalysis.js
Last active Mar 20, 2019
Simple JavaScript code to access the Azure Cognitive Services for Computer Vision
View imageAnalysis.js
// Basic JavaScript function to submit an image to the Microsoft Cognitive Services API.
// Note: to get this running, you need a valid subscription key. Also, make sure you
// adapt the URL of the service to match the region where you created it (see the TODO comment).
// Microsoft tutorial:
function analyzeButtonClick() {
// Retrieve the user-entered value of the image URL
let sourceImageUrl = $("#inputImage").val();
andijakl / cognitive.html
Created Mar 20, 2019
HTML page for simple Microsoft Azure Cognitive Services example for image description
View cognitive.html
<!DOCTYPE html>
<title>Cognitive Services Sample</title>
<script src=""></script>
<script src="imageAnalysis.js"></script>
andijakl / MainActivity.kt
Created Jan 28, 2019
Network request with additional try / catch to handle an IOException
View MainActivity.kt
private fun loadPartsAndUpdateList() {
GlobalScope.launch(Dispatchers.Main) {
try {
// Execute web request through coroutine call adapter & retrofit
val webResponse = WebAccess.partsApi.getPartsAsync().await()
if (webResponse.isSuccessful) {
// Get the returned & parsed JSON from the web response.
// Type specified explicitly here to make it clear that we already
// get parsed contents.
andijakl / PartDetailActivity.kt
Created Jan 25, 2019
Functions to perform Add, Delete and Update operations with the web service using Retrofit and Kotlin Coroutines
View PartDetailActivity.kt
private fun addPart(partItem: PartData) {
GlobalScope.launch(Dispatchers.Main) {
val webResponse = WebAccess.partsApi.addPartAsync(partItem).await()
Log.d(tag, "Add success: ${webResponse.isSuccessful}")
// TODO: Re-load list for the recycler view
private fun deletePart(itemId : Long) {
GlobalScope.launch(Dispatchers.Main) {
View MainActivity.kt
class MainActivity : AppCompatActivity() {
// Reference to the RecyclerView adapter
private lateinit var adapter: PartAdapter
private fun loadPartsAndUpdateList() {
// Launch Kotlin Coroutine on Android's main thread
GlobalScope.launch(Dispatchers.Main) {
// Execute web request through coroutine call adapter & retrofit
val webResponse = WebAccess.partsApi.getPartsAsync().await()
andijakl / WebAccess.kt
Created Jan 24, 2019
Retrofit instance created through Singleton pattern in Kotlin using lazy initialization
View WebAccess.kt
package com.andresjakl.partslist
import android.util.Log
import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
// Singleton pattern in Kotlin:
object WebAccess {
val partsApi : PartsApiClient by lazy {
andijakl / PartsApiClient.kt
Created Jan 24, 2019
Interface for a REST web service using Kotlin Coroutines for Retrofit
View PartsApiClient.kt
package com.andresjakl.partslist
import kotlinx.coroutines.Deferred
import retrofit2.Response
import retrofit2.http.*
interface PartsApiClient {
@GET("parts") fun getPartsAsync(): Deferred<Response<List<PartData>>>
@POST("parts") fun addPartAsync(@Body newPart : PartData): Deferred<Response<Void>>
@DELETE("parts/{id}") fun deletePartAsync(@Path("id") id: Long) : Deferred<Response<Void>>
You can’t perform that action at this time.