Put json value to Hazelcast as json format from nifi - apache-nifi

How can I put json flow file to Hazelcast cache?
when I put data it has a binary format.
Flow file content example:
{
"InsCode": 72055516303318490,
"IsinCode": "IRO9MKBT6041",
"Symbol": "ضمخا8009",
"Company": "اختيارخ اخابر-12000-1401/08/29",
"LastTradeTime": 61457,
"FirstPrice": 0,
"ClosePrice": 1,
"LastPrice": 1,
"TransactionCount": 0,
"Volume": 0,
"Value": 0,
"LowPrice": 0,
"HighPrice": 0,
"YesyterdayPrice": 1,
"EPS": null,
"BaseVolume": 1,
"UnkownCol1": 200,
"Flow": 3,
"SectorID": 64,
"MaxAllowedPrice": 100000,
"MinAlloedPrice": 1,
"NumberOfShare": 1000,
"YVal": 311,
"DateKey": "20220516",
"CreatedAt": "2022-05-16 09:54:01.887Z"
}
But when I get data from Hazelcast API it would be like this:
In response header, content-type is application/binary

Related

Retrieving data from REST API

I am trying to implement my first project in Laravel that will contain APIs, more specifically the Sportmonks API. What is the best way to get the data and display it in my view?
I have managed to display some of the data, but I do not know the correct way to display the data from the "standings", as well as from the tables that it has in it (overall, home, away, total)
API returns
{
"data": [{
"id": 77447501,
"name": "1st Phase",
"league_id": 501,
"season_id": 17141,
"round_id": 195000,
"round_name": 33,
"type": "Group Stage",
"stage_id": 77447501,
"stage_name": "1st Phase",
"resource": "stage",
"standings": {
"data": [{
"position": 1,
"team_id": 62,
"team_name": "Rangers",
"round_id": 195000,
"round_name": 33,
"group_id": null,
"group_name": null,
"overall": {
"games_played": 33,
"won": 28,
"draw": 5,
"lost": 0,
"goals_scored": 78,
"goals_against": 10,
"points": 89
},
"home": {
"games_played": 16,
"won": 16,
"draw": 0,
"lost": 0,
"goals_scored": 47,
"goals_against": 2,
"points": 48
},
"away": {
"games_played": 17,
"won": 12,
"draw": 5,
"lost": 0,
"goals_scored": 31,
"goals_against": 8,
"points": 41
},
"total": {
"goal_difference": "68",
"points": 89
},
"result": "Championship Round",
"points": 89,
"recent_form": "WWWWD",
"status": null
}],....
}
}]
}
Controller
public function index() {
$response = Http::get('apiurl');
$response->json();
$result = json_decode($response, true);
$matches = $result['data'];
return view('/api', compact('matches'));
}
Instead of returning json you can return object
$response = Http::get('apiurl');
$result=$response->object();
$matches=$result->data;
return view('/api', compact('matches'));
then in your view
#foreach($matches as $match)
#foeach($match->standings->data as $standing)
{{$standing->team_name??null}}
#endforeach
#endforeach

Convert Flash Coordinate into GeoJSON

I have a legacy .swf file that my team used to create a custom map.
The .swf file looks like this with following format:
{
"Signature": "CWS",
"Version": 8,
"FileLength": 87736,
"FrameSize": {
"Xmin": 0,
"Xmax": 14400,
"Ymin": 0,
"Ymax": 10000
},
"FrameRate": 12,
"FrameCount": 1,
"Tags": [
{
"TagName": "FileAttributes",
"Length": 4,
"Reserved": 0,
"HasMetaData": 0,
"SWFFlagsAS3": 0,
"SWFFlagsNoCrossDomainCache": 0,
"SWFFlagsUseNetwork": 0,
"UNDEFINED": 0
},
{
"TagName": "SetBackgroundColor",
"Length": 3,
"BackgroundColor": [
51,
51,
51
]
},
{
"TagName": "Protect",
"Length": 0
},
{
"TagName": "DefineShape4",
"Length": 309,
"ShapeId": 1,
"ShapeBounds": {
"Xmin": 10629,
"Xmax": 12137,
"Ymin": 4084,
"Ymax": 4748
},
"EdgeBounds": {
"Xmin": 10630,
"Xmax": 12136,
"Ymin": 4085,
"Ymax": 4747
},
"Reserved": 0,
"UsesFillWindingRule": 0,
"UsesNonScalingStrokes": 0,
"UsesScalingStrokes": 1,
"Shapes": {
"FillStyles": [
{
"FillStyleType": 0,
"FillStyleName": "solid fill",
"Color": [
255,
255,
102,
255
]
}
],
"LineStyles": [
{
"Width": 2,
"StartCapStyle": 0,
"JoinStyle": 0,
"HasFillFlag": 0,
"NoHScaleFlag": 0,
"NoVScaleFlag": 0,
"PixelHintingFlag": 0,
"Reserved": 0,
"NoClose": 0,
"EndCapStyle": 0,
"Color": [
255,
255,
255,
255
]
},
{
"Width": 2,
"StartCapStyle": 0,
"JoinStyle": 0,
"HasFillFlag": 0,
"NoHScaleFlag": 0,
"NoVScaleFlag": 0,
"PixelHintingFlag": 0,
"Reserved": 0,
"NoClose": 0,
"EndCapStyle": 0,
"Color": [
255,
255,
102,
255
]
}
],
"FillBits": 1,
"LineBits": 2,
"ShapeRecords": [
{
"RecordType": "stylechange",
"MoveDeltaX": 10630,
"MoveDeltaY": 4306,
"LineStyle": 1
},
{
"RecordType": "straightedge",
"LineType": "General",
"DeltaX": 23,
"DeltaY": -1
},
},
}
What format is this? and is there a way to convert this to GeoJson format so I can use it with d3.js?
To be specific, this is the data data for US combatant command(COCOM) map. I could not find the GeoJson format of this map in the entire Internet, so my only hope is to covert the legacy data into GeoJson
I ended up drawing my own cocom map using Geojson.io. I don't think there is a simple way to convert ShapeRecord to GeoJson since it is a completely different coordinate system.

Elasticsearch: What's the shape/model of failures object in the delete by query response?

According to the ElasticSearch documentation, the delete by query response looks like this:
{
"took" : 147,
"timed_out": false,
"total": 119,
"deleted": 119,
"batches": 1,
"version_conflicts": 0,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": -1.0,
"throttled_until_millis": 0,
"failures" : [ ]
}
How do I find out what the shape/model of the failures object is so that I can add failure handling logic on the client-side?
Edit: I found the Faliure class from the ElasticSearch Github repository, which is a good starting point.

Spring RestTemplate getting Converter exception when using ParameterizedTypeReference

Have the following code which correctly recieves String data from REST call and deserializes it:
String testDocumentJson = this.restTemplate.postForObject(url, data, String.class);
ObjectMapper mapper = new ObjectMapper();
The server response is:
{
"content": [{
"name": 99,
"id1": 25,
"id2": 25,
],
"last": true,
"totalPages": 1,
"totalElements": 53,
"size": 2500,
"number": 0,
"first": true,
"sort": null,
"numberOfElements": 1
}
}
Also this example works fine if not used with ParameterizedTypeReference i.e
Can someone please help as to how to resolve this.

GetStats duration and interval parameters, clarifying API documentation for Jelastic API

https://docs.jelastic.com/api/?class=environment.Control&member=GetStats
At the above link in the Jelastic API documentation for the GetStats method there are two parameters duration and interval.
When querying the api i can't figure out how these two parameters interact with each other.
If i query with the below i would expect 100 records at a resolution of 1 minute
/1.0/environment/control/rest/getstats?domain=[myDomiain]&session=[MySession]&duration=6000&interval=60&nodeid=[MyNode]
What i get back is 4 records for each hour so i'm unsure of how the parameters work.
Should i be using GetSumStats?
My final question would be what format are the cpu and mem stats in? MHz and Bytes?
{
"iops_used": 0,
"duration": 3600,
"cpumhz": 3,
"start": "2016-05-03 08:00:00",
"disk": 2141,
"mem": 194840,
"cpu": 12254,
"capacity": 0,
"net": {
"in_int": 703019,
"out_int": 566947,
"in_ext": 46222,
"out_ext": 367209
}
},
{
"iops_used": 0,
"duration": 3600,
"cpumhz": 3,
"start": "2016-05-03 09:00:00",
"disk": 2141,
"mem": 171992,
"cpu": 10076,
"capacity": 0,
"net": {
"in_int": 156703,
"out_int": 314023,
"in_ext": 12627,
"out_ext": 13535
}
},
{
"iops_used": 0,
"duration": 3580,
"cpumhz": 3,
"start": "2016-05-03 10:00:00",
"disk": 2141,
"mem": 172400,
"cpu": 11198,
"capacity": 0,
"net": {
"in_int": 515521,
"out_int": 551317,
"in_ext": 10329,
"out_ext": 17161
}
},
{
"iops_used": 0,
"duration": 3601,
"cpumhz": 3,
"start": "2016-05-03 11:00:00",
"disk": 2141,
"mem": 172610,
"cpu": 10032,
"capacity": 0,
"net": {
"in_int": 153394,
"out_int": 310694,
"in_ext": 10285,
"out_ext": 11210
}
}
#dlearious, for using interval equal 60 you should set duration value to 3600. This is due to the fact that Jelastic keeps detailed data hourly.
Also, you can start from minimal interval = 20.
Jelastic shows cpu in milliseconds and mem in Bytes.

Resources