What reasons can be, that i get KotlinNullPointerException when i try to use txBuilder.toLedgerTransaction(getServiceHub())? I used verify() and then i realised that problem is in toLedgerTransaction(). This problem appeared when i add new fields to State. They had co.paralleluniverse.common.util.Pair type and i think that there are some problems with serialization. Error message:
"stackTrace": [
{
"methodName": "reportGet",
"fileName": null,
"lineNumber": -1,
"className": "java.util.concurrent.CompletableFuture",
"nativeMethod": false
},
{
"methodName": "get",
"fileName": null,
"lineNumber": -1,
"className": "java.util.concurrent.CompletableFuture",
"nativeMethod": false
},
{
"methodName": "get",
"fileName": "CordaFutureImpl.kt",
"lineNumber": -1,
"className": "net.corda.core.internal.concurrent.CordaFutureImpl",
"nativeMethod": false
},
{
"methodName": "createProject",
"fileName": "ClientHttpApi.java",
"lineNumber": 136,
"className": "com.template.api.ClientHttpApi",
"nativeMethod": false
},
{
"methodName": "invoke0",
"fileName": null,
"lineNumber": -2,
"className": "sun.reflect.NativeMethodAccessorImpl",
"nativeMethod": true
},
{
"methodName": "invoke",
"fileName": null,
"lineNumber": -1,
"className": "sun.reflect.NativeMethodAccessorImpl",
"nativeMethod": false
},
{
"methodName": "invoke",
"fileName": null,
"lineNumber": -1,
"className": "sun.reflect.DelegatingMethodAccessorImpl",
"nativeMethod": false
},
{
"methodName": "invoke",
"fileName": null,
"lineNumber": -1,
"className": "java.lang.reflect.Method",
"nativeMethod": false
},
{
"methodName": "invoke",
"fileName": "ResourceMethodInvocationHandlerFactory.java",
"lineNumber": 81,
"className": "org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1",
"nativeMethod": false
},
{
"methodName": "run",
"fileName": "AbstractJavaResourceMethodDispatcher.java",
"lineNumber": 144,
"className": "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1",
"nativeMethod": false
},
{
"methodName": "invoke",
"fileName": "AbstractJavaResourceMethodDispatcher.java",
"lineNumber": 161,
"className": "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher",
"nativeMethod": false
},
{
"methodName": "doDispatch",
"fileName": "JavaResourceMethodDispatcherProvider.java",
"lineNumber": 160,
"className": "org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker",
"nativeMethod": false
},
{
"methodName": "dispatch",
"fileName": "AbstractJavaResourceMethodDispatcher.java",
"lineNumber": 99,
"className": "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher",
"nativeMethod": false
},
{
"methodName": "invoke",
"fileName": "ResourceMethodInvoker.java",
"lineNumber": 389,
"className": "org.glassfish.jersey.server.model.ResourceMethodInvoker",
"nativeMethod": false
},
{
"methodName": "apply",
"fileName": "ResourceMethodInvoker.java",
"lineNumber": 347,
"className": "org.glassfish.jersey.server.model.ResourceMethodInvoker",
"nativeMethod": false
},
{
"methodName": "apply",
"fileName": "ResourceMethodInvoker.java",
"lineNumber": 102,
"className": "org.glassfish.jersey.server.model.ResourceMethodInvoker",
"nativeMethod": false
},
{
"methodName": "run",
"fileName": "ServerRuntime.java",
"lineNumber": 326,
"className": "org.glassfish.jersey.server.ServerRuntime$2",
"nativeMethod": false
},
{
"methodName": "call",
"fileName": "Errors.java",
"lineNumber": 271,
"className": "org.glassfish.jersey.internal.Errors$1",
"nativeMethod": false
},
{
"methodName": "call",
"fileName": "Errors.java",
"lineNumber": 267,
"className": "org.glassfish.jersey.internal.Errors$1",
"nativeMethod": false
},
{
"methodName": "process",
"fileName": "Errors.java",
"lineNumber": 315,
"className": "org.glassfish.jersey.internal.Errors",
"nativeMethod": false
},
{
"methodName": "process",
"fileName": "Errors.java",
"lineNumber": 297,
"className": "org.glassfish.jersey.internal.Errors",
"nativeMethod": false
},
{
"methodName": "process",
"fileName": "Errors.java",
"lineNumber": 267,
"className": "org.glassfish.jersey.internal.Errors",
"nativeMethod": false
},
{
"methodName": "runInScope",
"fileName": "RequestScope.java",
"lineNumber": 317,
"className": "org.glassfish.jersey.process.internal.RequestScope",
"nativeMethod": false
},
{
"methodName": "process",
"fileName": "ServerRuntime.java",
"lineNumber": 305,
"className": "org.glassfish.jersey.server.ServerRuntime",
"nativeMethod": false
},
{
"methodName": "handle",
"fileName": "ApplicationHandler.java",
"lineNumber": 1154,
"className": "org.glassfish.jersey.server.ApplicationHandler",
"nativeMethod": false
},
{
"methodName": "serviceImpl",
"fileName": "WebComponent.java",
"lineNumber": 473,
"className": "org.glassfish.jersey.servlet.WebComponent",
"nativeMethod": false
},
{
"methodName": "service",
"fileName": "WebComponent.java",
"lineNumber": 427,
"className": "org.glassfish.jersey.servlet.WebComponent",
"nativeMethod": false
},
{
"methodName": "service",
"fileName": "ServletContainer.java",
"lineNumber": 388,
"className": "org.glassfish.jersey.servlet.ServletContainer",
"nativeMethod": false
},
{
"methodName": "service",
"fileName": "ServletContainer.java",
"lineNumber": 341,
"className": "org.glassfish.jersey.servlet.ServletContainer",
"nativeMethod": false
},
{
"methodName": "service",
"fileName": "ServletContainer.java",
"lineNumber": 228,
"className": "org.glassfish.jersey.servlet.ServletContainer",
"nativeMethod": false
},
{
"methodName": "handle",
"fileName": "ServletHolder.java",
"lineNumber": 841,
"className": "org.eclipse.jetty.servlet.ServletHolder",
"nativeMethod": false
},
{
"methodName": "doHandle",
"fileName": "ServletHandler.java",
"lineNumber": 535,
"className": "org.eclipse.jetty.servlet.ServletHandler",
"nativeMethod": false
},
{
"methodName": "nextHandle",
"fileName": "ScopedHandler.java",
"lineNumber": 188,
"className": "org.eclipse.jetty.server.handler.ScopedHandler",
"nativeMethod": false
},
{
"methodName": "doHandle",
"fileName": "ContextHandler.java",
"lineNumber": 1253,
"className": "org.eclipse.jetty.server.handler.ContextHandler",
"nativeMethod": false
},
{
"methodName": "nextScope",
"fileName": "ScopedHandler.java",
"lineNumber": 168,
"className": "org.eclipse.jetty.server.handler.ScopedHandler",
"nativeMethod": false
},
{
"methodName": "doScope",
"fileName": "ServletHandler.java",
"lineNumber": 473,
"className": "org.eclipse.jetty.servlet.ServletHandler",
"nativeMethod": false
},
{
"methodName": "nextScope",
"fileName": "ScopedHandler.java",
"lineNumber": 166,
"className": "org.eclipse.jetty.server.handler.ScopedHandler",
"nativeMethod": false
},
{
"methodName": "doScope",
"fileName": "ContextHandler.java",
"lineNumber": 1155,
"className": "org.eclipse.jetty.server.handler.ContextHandler",
"nativeMethod": false
},
{
"methodName": "handle",
"fileName": "ScopedHandler.java",
"lineNumber": 141,
"className": "org.eclipse.jetty.server.handler.ScopedHandler",
"nativeMethod": false
},
{
"methodName": "handle",
"fileName": "HandlerCollection.java",
"lineNumber": 126,
"className": "org.eclipse.jetty.server.handler.HandlerCollection",
"nativeMethod": false
},
{
"methodName": "handle",
"fileName": "HandlerWrapper.java",
"lineNumber": 132,
"className": "org.eclipse.jetty.server.handler.HandlerWrapper",
"nativeMethod": false
},
{
"methodName": "handle",
"fileName": "Server.java",
"lineNumber": 561,
"className": "org.eclipse.jetty.server.Server",
"nativeMethod": false
},
{
"methodName": "handle",
"fileName": "HttpChannel.java",
"lineNumber": 334,
"className": "org.eclipse.jetty.server.HttpChannel",
"nativeMethod": false
},
{
"methodName": "onFillable",
"fileName": "HttpConnection.java",
"lineNumber": 251,
"className": "org.eclipse.jetty.server.HttpConnection",
"nativeMethod": false
},
{
"methodName": "succeeded",
"fileName": "AbstractConnection.java",
"lineNumber": 279,
"className": "org.eclipse.jetty.io.AbstractConnection$ReadCallback",
"nativeMethod": false
},
{
"methodName": "fillable",
"fileName": "FillInterest.java",
"lineNumber": 104,
"className": "org.eclipse.jetty.io.FillInterest",
"nativeMethod": false
},
{
"methodName": "run",
"fileName": "ChannelEndPoint.java",
"lineNumber": 124,
"className": "org.eclipse.jetty.io.ChannelEndPoint$2",
"nativeMethod": false
},
{
"methodName": "runJob",
"fileName": "QueuedThreadPool.java",
"lineNumber": 679,
"className": "org.eclipse.jetty.util.thread.QueuedThreadPool",
"nativeMethod": false
},
{
"methodName": "run",
"fileName": "QueuedThreadPool.java",
"lineNumber": 597,
"className": "org.eclipse.jetty.util.thread.QueuedThreadPool$2",
"nativeMethod": false
},
{
"methodName": "run",
"fileName": null,
"lineNumber": -1,
"className": "java.lang.Thread",
"nativeMethod": false
}
],
"localizedMessage": "kotlin.KotlinNullPointerException: net.corda.core.contracts.TransactionState -> data(net.corda.core.contracts.ContractState) -> null",
"message": "kotlin.KotlinNullPointerException: net.corda.core.contracts.TransactionState -> data(net.corda.core.contracts.ContractState) -> null",
"suppressed": []
Stack trace ends with a call of flow through CordaRPCOps, so it's not useful.
I believe you are implementing an old syntax of verifying the transaction. With the later versions of Corda, the TransactionBuilder object is already able to call the verify() method.
For example:
// Build the transaction, add the output state and the command to the transaction.
TransactionBuilder transactionBuilder = new TransactionBuilder(notary)
.addOutputState(output)
.addCommand(new AssetContract.Commands.CreateAsset(),
Arrays.asList(getOurIdentity().getOwningKey())); // Required Signers
// Verify the transaction
transactionBuilder.verify(getServiceHub());
Full codes at:
https://github.com/corda/samples-java/blob/master/Advanced/auction-cordapp/workflows/src/main/java/net/corda/samples/flows/CreateAssetFlow.java#L59
Related
i would like to use gradient backgrounds in particles, that is to say, I want the particles to each have a gradient of different colours with some shadows for depth and if at all its possible, i would like to animate the gradeients as well.
I am new to this library and am not sure if this is possible, Thanks!
i have made a simple canvas with circles bouncing around, thats all i have been able to achieve
{
"autoPlay": true,
"background": {
"color": {
"value": "#000"
},
"image": "",
"position": "",
"repeat": "",
"size": "",
"opacity": 1
},
"backgroundMask": {
"composite": "destination-out",
"cover": {
"color": {
"value": "#fff"
},
"opacity": 1
},
"enable": false
},
"defaultThemes": {},
"delay": 0,
"fullScreen": {
"enable": true,
"zIndex": -1
},
"detectRetina": true,
"duration": 0,
"fpsLimit": 120,
"interactivity": {
"detectsOn": "window",
"events": {
"onClick": {
"enable": false,
"mode": []
},
"onDiv": {
"selectors": [],
"enable": false,
"mode": [],
"type": "circle"
},
"onHover": {
"enable": false,
"mode": [],
"parallax": {
"enable": false,
"force": 2,
"smooth": 10
}
},
"resize": {
"delay": 0.5,
"enable": true
}
},
"modes": {
"attract": {
"distance": 200,
"duration": 0.4,
"easing": "ease-out-quad",
"factor": 1,
"maxSpeed": 50,
"speed": 1
},
"bounce": {
"distance": 200
},
"bubble": {
"distance": 200,
"duration": 0.4,
"mix": false,
"divs": {
"distance": 200,
"duration": 0.4,
"mix": false,
"selectors": []
}
},
"connect": {
"distance": 80,
"links": {
"opacity": 0.5
},
"radius": 60
},
"grab": {
"distance": 100,
"links": {
"blink": false,
"consent": false,
"opacity": 1
}
},
"push": {
"default": true,
"groups": [],
"quantity": 4
},
"remove": {
"quantity": 2
},
"repulse": {
"distance": 200,
"duration": 0.4,
"factor": 100,
"speed": 1,
"maxSpeed": 50,
"easing": "ease-out-quad",
"divs": {
"distance": 200,
"duration": 0.4,
"factor": 100,
"speed": 1,
"maxSpeed": 50,
"easing": "ease-out-quad",
"selectors": []
}
},
"slow": {
"factor": 3,
"radius": 200
},
"trail": {
"delay": 1,
"pauseOnStop": false,
"quantity": 1
},
"light": {
"area": {
"gradient": {
"start": {
"value": "#ffffff"
},
"stop": {
"value": "#000000"
}
},
"radius": 1000
},
"shadow": {
"color": {
"value": "#000000"
},
"length": 2000
}
}
}
},
"manualParticles": [],
"particles": {
"bounce": {
"horizontal": {
"random": {
"enable": false,
"minimumValue": 0.1
},
"value": 1
},
"vertical": {
"random": {
"enable": false,
"minimumValue": 0.1
},
"value": 1
}
},
"collisions": {
"absorb": {
"speed": 2
},
"bounce": {
"horizontal": {
"random": {
"enable": false,
"minimumValue": 1
},
"value": {
"min": 0.1,
"max": 10
}
},
"vertical": {
"random": {
"enable": false,
"minimumValue": 0.1
},
"value": {
"min": 0.1,
"max": 10
}
}
},
"enable": true,
"mode": "bounce",
"overlap": {
"enable": false,
"retries": 0
}
},
"color": {
"value": "#ff0000",
"animation": {
"h": {
"count": 0,
"enable": false,
"offset": 0,
"speed": 1,
"decay": 0,
"sync": true
},
"s": {
"count": 0,
"enable": false,
"offset": 0,
"speed": 1,
"decay": 0,
"sync": true
},
"l": {
"count": 0,
"enable": false,
"offset": 0,
"speed": 1,
"decay": 0,
"sync": true
}
}
},
"groups": {},
"move": {
"angle": {
"offset": 0,
"value": 90
},
"attract": {
"distance": 200,
"enable": false,
"rotate": {
"x": 3000,
"y": 3000
}
},
"center": {
"x": 50,
"y": 50,
"mode": "percent",
"radius": 0
},
"decay": 0,
"distance": {},
"direction": "none",
"drift": 0,
"enable": true,
"gravity": {
"acceleration": 9.81,
"enable": false,
"inverse": false,
"maxSpeed": 50
},
"path": {
"clamp": true,
"delay": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 0
},
"enable": false,
"options": {}
},
"outModes": {
"default": "bounce",
"bottom": "bounce",
"left": "bounce",
"right": "bounce",
"top": "bounce"
},
"random": true,
"size": true,
"speed": 8,
"spin": {
"acceleration": 0,
"enable": false
},
"straight": false,
"trail": {
"enable": true,
"length": 3,
"fillColor": {
"value": "#000000"
}
},
"vibrate": false,
"warp": false
},
"number": {
"density": {
"enable": false,
"area": 800,
"factor": 1000
},
"limit": 0,
"value": 14
},
"opacity": {
"random": {
"enable": false,
"minimumValue": 0.1
},
"value": 1,
"animation": {
"count": 0,
"enable": false,
"speed": 0.25,
"decay": 0,
"sync": false,
"destroy": "none",
"startValue": "random"
}
},
"reduceDuplicates": false,
"shadow": {
"blur": 4,
"color": {
"value": "#000"
},
"enable": true,
"offset": {
"x": 0,
"y": 0
}
},
"shape": {
"options": {},
"type": "circle"
},
"size": {
"random": {
"enable": false,
"minimumValue": 1
},
"value": 41,
"animation": {
"count": 0,
"enable": false,
"speed": 5,
"decay": 0,
"sync": false,
"destroy": "none",
"startValue": "random"
}
},
"stroke": {
"width": 0,
"color": {
"value": "#004cff",
"animation": {
"h": {
"count": 0,
"enable": false,
"offset": 0,
"speed": 1,
"decay": 0,
"sync": true
},
"s": {
"count": 0,
"enable": false,
"offset": 0,
"speed": 1,
"decay": 0,
"sync": true
},
"l": {
"count": 0,
"enable": false,
"offset": 0,
"speed": 1,
"decay": 0,
"sync": true
}
}
}
},
"zIndex": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 0,
"opacityRate": 1,
"sizeRate": 1,
"velocityRate": 1
},
"life": {
"count": 0,
"delay": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 0,
"sync": false
},
"duration": {
"random": {
"enable": false,
"minimumValue": 0.0001
},
"value": 0,
"sync": false
}
},
"rotate": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 0,
"animation": {
"enable": false,
"speed": 0,
"decay": 0,
"sync": false
},
"direction": "clockwise",
"path": false
},
"destroy": {
"bounds": {},
"mode": "none",
"split": {
"count": 1,
"factor": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 3
},
"rate": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": {
"min": 4,
"max": 9
}
},
"sizeOffset": true,
"particles": {}
}
},
"roll": {
"darken": {
"enable": false,
"value": 0
},
"enable": false,
"enlighten": {
"enable": false,
"value": 0
},
"mode": "vertical",
"speed": 25
},
"tilt": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 0,
"animation": {
"enable": false,
"speed": 0,
"decay": 0,
"sync": false
},
"direction": "clockwise",
"enable": false
},
"twinkle": {
"lines": {
"enable": false,
"frequency": 0.05,
"opacity": 1
},
"particles": {
"enable": false,
"frequency": 0.05,
"opacity": 1
}
},
"wobble": {
"distance": 5,
"enable": false,
"speed": {
"angle": 50,
"move": 10
}
},
"orbit": {
"animation": {
"count": 0,
"enable": false,
"speed": 1,
"decay": 0,
"sync": false
},
"enable": false,
"opacity": 1,
"rotation": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 45
},
"width": 1
},
"links": {
"blink": false,
"color": {
"value": "#fff"
},
"consent": false,
"distance": 100,
"enable": false,
"frequency": 1,
"opacity": 1,
"shadow": {
"blur": 5,
"color": {
"value": "#000"
},
"enable": false
},
"triangles": {
"enable": false,
"frequency": 1
},
"width": 1,
"warp": false
},
"repulse": {
"random": {
"enable": false,
"minimumValue": 0
},
"value": 0,
"enabled": false,
"distance": 1,
"duration": 1,
"factor": 1,
"speed": 1
}
},
"pauseOnBlur": true,
"pauseOnOutsideViewport": true,
"responsive": [],
"smooth": false,
"style": {},
"themes": [],
"zLayers": 100,
"emitters": []
}
Could anyone helps me to add interactive highlight point on hover? I tried to add props from this example, but it did not work for me.
Here is my spec at Vega Lite Editor
The example is Vega-Lite but your spec is Vega. Try this - it gives a point and a tooltip for you.
{
"description": "Total Count line chart.",
"width": 1200,
"height": 450,
"padding": 5,
"signals": [{"name": "interpolate", "value": "linear"}],
"legends": [
{
"fill": "color",
"orient": "bottom",
"direction": "horizontal",
"symbolType": "square"
}
],
"data": [
{
"name": "table",
"values": [
{"x": 0, "y": 145, "c": "All"},
{"x": 1, "y": 153, "c": "All"},
{"x": 2, "y": 280, "c": "All"},
{"x": 3, "y": 150, "c": "All"},
{"x": 4, "y": 280, "c": "All"},
{"x": 5, "y": 140, "c": "All"},
{"x": 6, "y": 90, "c": "All"},
{"x": 0, "y": 30, "c": "Bulk carrier"},
{"x": 1, "y": 20, "c": "Bulk carrier"},
{"x": 2, "y": 90, "c": "Bulk carrier"},
{"x": 3, "y": 60, "c": "Bulk carrier"},
{"x": 4, "y": 50, "c": "Bulk carrier"},
{"x": 5, "y": 40, "c": "Bulk carrier"},
{"x": 6, "y": 10, "c": "Bulk carrier"},
{"x": 0, "y": 50, "c": "Tanker ship"},
{"x": 1, "y": 10, "c": "Tanker ship"},
{"x": 2, "y": 50, "c": "Tanker ship"},
{"x": 3, "y": 40, "c": "Tanker ship"},
{"x": 4, "y": 110, "c": "Tanker ship"},
{"x": 5, "y": 40, "c": "Tanker ship"},
{"x": 6, "y": 20, "c": "Tanker ship"},
{"x": 0, "y": 5, "c": "Dingy"},
{"x": 1, "y": 23, "c": "Dingy"},
{"x": 2, "y": 20, "c": "Dingy"},
{"x": 3, "y": 0, "c": "Dingy"},
{"x": 4, "y": 30, "c": "Dingy"},
{"x": 5, "y": 20, "c": "Dingy"},
{"x": 6, "y": 0, "c": "Dingy"},
{"x": 0, "y": 50, "c": "Carrier ship"},
{"x": 1, "y": 60, "c": "Carrier ship"},
{"x": 2, "y": 90, "c": "Carrier ship"},
{"x": 3, "y": 40, "c": "Carrier ship"},
{"x": 4, "y": 50, "c": "Carrier ship"},
{"x": 5, "y": 20, "c": "Carrier ship"},
{"x": 6, "y": 40, "c": "Carrier ship"},
{"x": 0, "y": 10, "c": "Other"},
{"x": 1, "y": 40, "c": "Other"},
{"x": 2, "y": 30, "c": "Other"},
{"x": 3, "y": 10, "c": "Other"},
{"x": 4, "y": 40, "c": "Other"},
{"x": 5, "y": 20, "c": "Other"},
{"x": 6, "y": 20, "c": "Other"}
]
}
],
"scales": [
{
"name": "x",
"type": "point",
"range": "width",
"domain": {"data": "table", "field": "x"}
},
{
"name": "y",
"type": "linear",
"range": "height",
"nice": true,
"zero": true,
"domain": {"data": "table", "field": "y"}
},
{
"name": "color",
"type": "ordinal",
"range": [
"#61c7f7",
"#BA20CE",
"#60cf85",
"#cd2c4f",
"#ceae39",
"#ffffff"
],
"domain": {"data": "table", "field": "c"}
}
],
"axes": [
{"orient": "bottom", "scale": "x"},
{"orient": "left", "scale": "y"}
],
"config": {
"style": {
"guide-label": {"fontSize": 14, "fill": "#cccccc", "fontWeight": 800}
},
"axis": {"grid": true, "gridColor": "#333333"}
},
"marks": [
{
"type": "group",
"from": {"facet": {"name": "series", "data": "table", "groupby": "c"}},
"marks": [
{
"type": "line",
"from": {"data": "series"},
"encode": {
"enter": {
"x": {"scale": "x", "field": "x"},
"y": {"scale": "y", "field": "y"},
"stroke": {"scale": "color", "field": "c"},
"strokeWidth": {"value": 2}
},
"update": {
"interpolate": {"signal": "interpolate"},
"strokeOpacity": {"value": 1}
},
"hover": {"strokeOpacity": {"value": 0.5}}
}
},
{
"type": "symbol",
"from": {"data": "series"},
"encode": {
"update": {
"x": {"scale": "x", "field": "x"},
"y": {"scale": "y", "field": "y"},
"fillOpacity": {"value": 0}
},
"hover": {"fillOpacity": {"value": 1},
"tooltip": {
"signal": "{'c':datum.c }"
}
}
}
}
]
}
]
}
A .NET 6 application Upserts documents to CosmosDB.
I get many debug messages (not all writes)
DocDBTrace Error: 0 : DocumentClientException with status code 449, message: Message: {"Errors":["Conflicting request to resource has been attempted. Retry to avoid conflicts."]}
the ids of the documents are Guid instances and there are no unique keys in the container (so no conflicts).
What could it be?
EDIT
partitionKey = id
//F#
let write database container items =
let container = client.GetContainer(database, container)
items
|> Seq.map (fun item -> container.UpsertItemAsync(item))
|> Seq.toArray
|> Task.WhenAll
Data sample
{
"RESPONSE": [
{
"IntradayTickResponse": {
"CorrelationID": "ESM2 Index:intraday",
"TimeReceived": "2022-05-05T01:19:38.338794Z",
"tickData": {
"eidData": null,
"tickData": [
{
"time": {
"DayOfMonth": 5,
"Hour": 0,
"MicroSecond": 0,
"MilliSecond": 0,
"Minute": 37,
"Month": 5,
"NanoSecond": 0,
"Parts": 2046,
"PicoSecond": 0,
"Second": 7,
"TimezoneOffsetMinutes": 0,
"Year": 2022
},
"type": "TRADE",
"value": 4292.5,
"size": 2,
"conditionCodes": "TSUM"
},
{
"time": {
"DayOfMonth": 5,
"Hour": 0,
"MicroSecond": 0,
"MilliSecond": 0,
"Minute": 37,
"Month": 5,
"NanoSecond": 0,
"Parts": 2046,
"PicoSecond": 0,
"Second": 19,
"TimezoneOffsetMinutes": 0,
"Year": 2022
},
"type": "TRADE",
"value": 4292.75,
"size": 2,
"conditionCodes": "TSUM"
},
{
"time": {
"DayOfMonth": 5,
"Hour": 0,
"MicroSecond": 0,
"MilliSecond": 0,
"Minute": 37,
"Month": 5,
"NanoSecond": 0,
"Parts": 2046,
"PicoSecond": 0,
"Second": 19,
"TimezoneOffsetMinutes": 0,
"Year": 2022
},
"type": "TRADE",
"value": 4292.75,
"size": 1,
"conditionCodes": "TSUM"
},
{
"time": {
"DayOfMonth": 5,
"Hour": 0,
"MicroSecond": 0,
"MilliSecond": 0,
"Minute": 37,
"Month": 5,
"NanoSecond": 0,
"Parts": 2046,
"PicoSecond": 0,
"Second": 19,
"TimezoneOffsetMinutes": 0,
"Year": 2022
},
"type": "TRADE",
"value": 4292.75,
"size": 1,
"conditionCodes": "TSUM"
},
{
"time": {
"DayOfMonth": 5,
"Hour": 0,
"MicroSecond": 0,
"MilliSecond": 0,
"Minute": 37,
"Month": 5,
"NanoSecond": 0,
"Parts": 2046,
"PicoSecond": 0,
"Second": 19,
"TimezoneOffsetMinutes": 0,
"Year": 2022
},
"type": "TRADE",
"value": 4292.75,
"size": 1,
"conditionCodes": "TSUM"
},
...
"id": "87fdc18a-61f2-4c43-a7a8-2904b14e6596",
"_rid": "maszAOGSZkYwAgAAAAAAAA==",
"_self": "dbs/maszAA==/colls/maszAOGSZkY=/docs/maszAOGSZkYwAgAAAAAAAA==/",
"_etag": "\"00000000-0000-0000-601e-3057eca901d8\"",
"_attachments": "attachments/",
"_ts": 1651713578
}
Good time of day!
all text - https://github.com/vega/vega-lite/issues/5697
When building data in a block, I would like to change the font size and position of the text in the block. Used the documentation -https://vega.github.io/vega-lite/docs/title.html, but it does not work.
block:
{
"mark": "text"
"encoding": {
"text": {"field": "z", "type": "quantitative"}
"color": {"value": "black"}
"fontSize": 40
}
Changing the position will allow for the addition of a second text:
full code:
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.3.json",
"config": {"view": {"height": 300, "width": 400}},
"data": {
"values": [
{"x": 0, "y": 0, "z": 0},
{"x": 1, "y": 0, "z": 1},
{"x": 2, "y": 0, "z": 4},
#{"x": 3, "y": 0, "z": 9},
{"x": 4, "y": 0, "z": 16},
#{"x": 5, "y": 0, "z": 25},
{"x": 0, "y": 1, "z": 1},
{"x": 1, "y": 1, "z": 2},
{"x": 2, "y": 1, "z": 5},
{"x": 3, "y": 1, "z": 10},
#{"x": 4, "y": 1, "z": 17},
{"x": 5, "y": 1, "z": 26}]
},
"encoding": {
"x": {"field": "x", "type": "ordinal", title: "X"}
"y": {"field": "y", "type": "ordinal", title: "Y"}
}
"layer": [
{
"mark": "rect"
from: {data: "values"}
"encoding": {
"color": {
"field": "z"
"scale": {"scheme": "redyellowgreen"}
"type": "quantitative"
}
}
}
{
"mark": "text"
"encoding": {
"text": {"field": "z", "type": "quantitative"}
"color": {"value": "black"}
"fontSize": 40
}
}
]
}
2 I'd like a temperature map without spaces. It is possible if create a variable to count all x by "groupby":[y]
Help me please.
There is no fontSize encoding, but you can set a fontSize mark property:
{
"mark": {"type": "text", "fontSize": 40},
"encoding": {
"text": {"field": "z", "type": "quantitative"},
"color": {"value": "black"}
}
}
To offset text vertically, you can use the dy mark property, which specifies a number of pixels by which to vertically offset the text:
{
"mark": {"type": "text", "fontSize": 20, "dy": -20},
"encoding": {
"text": {"value": "text"},
"color": {"value": "black"}
}
}
As for computing new x values to fill-in spaces, you can do this with a Window Transform.
Here is a modified version of your example that puts all of this together (view in vega editor):
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.3.json",
"config": {"view": {"height": 300, "width": 400}},
"data": {
"values": [
{"x": 0, "y": 0, "z": 0},
{"x": 1, "y": 0, "z": 1},
{"x": 2, "y": 0, "z": 4},
{"x": 4, "y": 0, "z": 16},
{"x": 0, "y": 1, "z": 1},
{"x": 1, "y": 1, "z": 2},
{"x": 2, "y": 1, "z": 5},
{"x": 3, "y": 1, "z": 10},
{"x": 5, "y": 1, "z": 26}
]
},
"transform": [
{"window": [{"op": "count", "field": "x", "as": "x2"}], "groupby": ["y"]}
],
"encoding": {
"x": {"field": "x2", "type": "ordinal", "title": "X"},
"y": {"field": "y", "type": "ordinal", "title": "Y"}
},
"layer": [
{
"mark": "rect",
"encoding": {
"color": {
"field": "z",
"scale": {"scheme": "redyellowgreen"},
"type": "quantitative"
}
}
},
{
"mark": {"type": "text", "fontSize": 20, "dy": -20},
"encoding": {
"text": {"value": "text"},
"color": {"value": "black"}
}
},
{
"mark": {"type": "text", "fontSize": 40, "dy": 20},
"encoding": {
"text": {"field": "z", "type": "quantitative"},
"color": {"value": "black"}
}
}
]
}
Have a weird problem with Google Maps Api. I make an autocomplete request to the Google Api Places like this.
https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=true&language=en&types=geocode&components=country:ua&input=Kiev,%20Dn&radius=30000&location=50.431698,30.503237&key={key}
The result gives me 5 addresses. Here is the JSON response:
{
"predictions": [{
"description": "Dniprovs'kyi district, Kiev, Kyiv city, Ukraine",
"id": "023b6f6008f0b58208c7c1360c15966d591ebbf5",
"matched_substrings": [{
"length": 2,
"offset": 0
},
{
"length": 4,
"offset": 23
}
],
"place_id": "ChIJ-2Pud7La1EARRomoyKV9Nvg",
"reference": "CoQBcQAAAM61hA62d_nNjn2xs7ooCbeAFvnHn9tlTWYxqxotYheKHD6-XVLEcTvnkRss16cMRVXF-9Wk3EmvrRm_R4_Tnvwyd1XVno0TWSk30OBb8b7n_f9rZjOgir0LIFDVDgVJY0cWmx5WHG2rxxtW_qz1r37-tw39WA6g6Qfv0yGf8-H2EhB1B8ZaolsxZ6IKgSp49aJHGhTSd8BUIKFeJ4Rbvh5cjqytLN8mBQ",
"terms":
[
{
"offset": 0,
"value": "Dniprovs'kyi district"
},
{
"offset": 23,
"value": "Kiev"
},
{
"offset": 29,
"value": "Kyiv city"
},
{
"offset": 40,
"value": "Ukraine"
}
],
"types":
[
"sublocality_level_1",
"sublocality",
"political",
"geocode"
]
},
{
"description": "Dniprovs'ka embankment, Kiev, Kyiv city, Ukraine",
"id": "584f6c97be66f9dfd62c318ce83f6534004a6c8a",
"matched_substrings":
[{
"length": 2,
"offset": 0
},
{
"length": 4,
"offset": 24
}
],
"place_id": "EjBEbmlwcm92cydrYSBlbWJhbmttZW50LCBLaWV2LCBLeWl2IGNpdHksIFVrcmFpbmU",
"reference": "CmReAAAAtDXrk0vEFiKYHNPPhPXYBoQOJ38NGGjbUf7mTRH8-_cqtiIkTDDsZXzuUSATgr_uiflldtH4nUrhW0rsFmUtrkQIUz6CZCGRQTUdAJh83zagGLcuVEs1xchGY1A2izTOEhCaI_oBksWVRhO_CRaYvgSzGhQr0eOrWKZV1GJoHpGbvrtO6QZ_Ug",
"terms":
[{
"offset": 0,
"value": "Dniprovs'ka embankment"
},
{
"offset": 24,
"value": "Kiev"
},
{
"offset": 30,
"value": "Kyiv city"
},
{
"offset": 41,
"value": "Ukraine"
}
],
"types":
[
"route",
"geocode"
]
},
{
"description": "Dnepr, Kiev, Kyiv city, Ukraine",
"id": "a3c4a39941ac4c54c2b176849696118af448a090",
"matched_substrings": [{
"length": 2,
"offset": 0
},
{
"length": 4,
"offset": 7
}
],
"place_id": "ChIJjcChbKPP1EARTXya5VgHmOk",
"reference": "CmRYAAAAZuPj8SP1flByvXUVAcO3eeYb-das4IJeBPxo_usffK_Oq2mZFPZdPwhyCmyCfrCECX5ZwssyGQdaEWCCkSkyKbDCq3ZPxbEqYlyGXDFGNJ4DqGn7mXVoEHwMKKb5DG3sEhBaeZXXm9Fh-zh_Ajl0paRKGhSy1Z9s4Uv1AU609L0sztasqQU6rg",
"terms":
[
{
"offset": 0,
"value": "Dnepr"
},
{
"offset": 7,
"value": "Kiev"
},
{
"offset": 13,
"value": "Kyiv city"
},
{
"offset": 24,
"value": "Ukraine"
}
],
"types":
[
"subway_station",
"train_station",
"transit_station",
"establishment",
"geocode"
]
},
{
"description": "Dnepr, Parkova Road, Kiev, Kyiv city, Ukraine",
"id": "973dc14397b70d5be6d2ddd3c5bc2a6e2de04b59",
"matched_substrings":
[{
"length": 2,
"offset": 0
},
{
"length": 4,
"offset": 21
}
],
"place_id": "ChIJQ_49j7LP1EARLXp2vRI8pws",
"reference": "CnRlAAAAiR50_V3AfqkhvGnoHhc4n6QjXkm-aWerLtLHEhxD6cJmGuirRktoafooAdbbGOzh97TSk1MklDfBs0fyrQgRnVjkDzzjioCspJ1La6gh8I8BUC0LTpABJOlkjrvz5wpC0HhXgYm4EbHqwZZY2aBYdBIQVqbAYC42ALmzxEqWXL5H9RoU4g-MKNF34R3Y9c_-5Z7lxf9n1vY",
"terms":
[{
"offset": 0,
"value": "Dnepr"
},
{
"offset": 7,
"value": "Parkova Road"
},
{
"offset": 21,
"value": "Kiev"
},
{
"offset": 27,
"value": "Kyiv city"
},
{
"offset": 38,
"value": "Ukraine"
}
],
"types":
[
"establishment",
"geocode"
]
},
{
"description": "Dnipro, Kiev, Kyiv city, Ukraine",
"id": "9e94078fbf056913f1bf0e3de90b04fc261d21b0",
"matched_substrings":
[{
"length": 2,
"offset": 0
},
{
"length": 4,
"offset": 8
}
],
"place_id": "ChIJMe5dbqPP1EARSnZi_bKNY0A",
"reference": "CmRYAAAAbkjesqoz4jiN86mZU5KG_hNatcXIc5GJMHvSzmIKgedGz5hmlVl_QKqyO1vupXGBLOi-wx64i0e_15mgNQbwjzGBabLTDuAC0H73PD9Dz3w0C4hMqHhsNjJmRsKLYTFMEhCvwWcBT_EWiCU5Fmr32bn2GhRKADBuv9Qq52rH2Ru5-0EdDPWlGw",
"terms":
[{
"offset": 0,
"value": "Dnipro"
},
{
"offset": 8,
"value": "Kiev"
},
{
"offset": 14,
"value": "Kyiv city"
},
{
"offset": 25,
"value": "Ukraine"
}
],
"types":
[
"bus_station",
"transit_station",
"establishment",
"geocode"
]
}
],
"status": "OK"
}
After this I try to get the place details for each address. Everything works fine for 4 of the addresses, but for the address "Dniprovs'ka embankment, Kiev, Kyiv city, Ukraine" with placeid
EjBEbmlwcm92cydrYSBlbWJhbmttZW50LCBLaWV2LCBLeWl2IGNpdHksIFVrcmFpbmU
the Google Places API responses
404: request:
https://maps.googleapis.com/maps/api/place/details/json?placeid=EjBEbmlwcm92cydrYSBlbWJhbmttZW50LCBLaWV2LCBLeWl2IGNpdHksIFVrcmFpbmU&key={key}
, response: {"html_attributions": [ ],"status": "NOT_FOUND"}
What am I doing wrong?
Thanks for help.