Azure Stream Analytics Query Returns 0 rows - sql

I have data coming in from KEPServerEx with nested lists, so I need to CROSS APPLY to send individual values to my blob from the incoming stream. I had the query working for a few minutes utilizing this post (iterate nested list in json msg by cql stream analytics) but can no longer get a correct output.
A message looks like this:
[
{
"timestamp": 1575933997508,
"values": [
{
"id": "Channel1.Device1.RANDOM1",
"v": 5,
"q": 1,
"t": 1575933987573
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 196,
"q": 1,
"t": 1575933988076
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 56,
"q": 1,
"t": 1575933988570
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 104,
"q": 1,
"t": 1575933989077
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 24,
"q": 1,
"t": 1575933989567
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 177,
"q": 1,
"t": 1575933990069
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 168,
"q": 1,
"t": 1575933990575
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 113,
"q": 1,
"t": 1575933991067
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 189,
"q": 1,
"t": 1575933991572
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 96,
"q": 1,
"t": 1575933992075
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 15,
"q": 1,
"t": 1575933992567
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 179,
"q": 1,
"t": 1575933993074
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 22,
"q": 1,
"t": 1575933993569
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 98,
"q": 1,
"t": 1575933994073
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 9,
"q": 1,
"t": 1575933994575
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 142,
"q": 1,
"t": 1575933995071
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 54,
"q": 1,
"t": 1575933995576
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 174,
"q": 1,
"t": 1575933996070
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 188,
"q": 1,
"t": 1575933996567
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 45,
"q": 1,
"t": 1575933997073
}
]
}
]
The query I used to successfully split the above message list of values into individual values is:
SELECT
event.timestamp as messageTS,
[values].ArrayValue.id,
[values].ArrayValue.v,
[values].ArrayValue.t as valueTS
FROM
brewingmqtt AS event
CROSS APPLY getarrayelements(event.eachvalue) AS [values]
Unfortunately, this is now giving me 0 rows return when performing a test and I cannot figure out what I am missing.

Why you set eachvalue in getArrayElements function? Your sample data indicates that it should be [values]. I tested the sql based on your sample data and it works for me.
SELECT
event.timestamp as messageTS,
[values].ArrayValue.id,
[values].ArrayValue.v,
[values].ArrayValue.t as valueTS
FROM
brewingmqtt AS event
CROSS APPLY getarrayelements(event.[values]) AS [values]
Output:

Related

How check if record exist in an unlimited nested children relationship

I am struggling to come up with a way to query this. I have a model that displays a resource with its children and the children are from the same table itself which means the resource tree is unlimited nesting. the relation is as follows
class UserDrive extends Model
{
public function children(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(self::class, 'folder_id','id')->with('children');
}
}
and my controller calls it like shown below
public function getFolder($folder_id)
{
return new UserDriveCollection(UserDrive::with("children")->where('user_id', $this->user)->where('id', $folder_id)->paginate($this->paginatePerPage(), ['*'], 'page', 1));
}
the resource looks like below
public function toArray($request)
{
return [
"id" => $this->id,
"folder_name" => $this->folder_name,
"children" => self::collection($this->whenLoaded('children'))
];
}
and the results are in the following format
[
{
"id": 1,
"folder_name": "Setswana Material",
"children": [
{
"id": 2,
"folder_name": "Love Materials",
"children": [
{
"id": 11,
"folder_name": "folder54",
"children": [
{
"id": 19,
"folder_name": "folder1",
"children": []
},
{
"id": 20,
"folder_name": "folder2",
"children": []
},
{
"id": 21,
"folder_name": "folder",
"children": []
},
{
"id": 22,
"folder_name": "folder3",
"children": []
},
{
"id": 23,
"folder_name": "folder4",
"children": []
},
{
"id": 24,
"folder_name": "folder5",
"children": []
}
]
},
{
"id": 12,
"folder_name": "folder5",
"children": []
},
{
"id": 13,
"folder_name": "\nfolder5",
"children": []
},
{
"id": 14,
"folder_name": "folder",
"children": []
},
{
"id": 15,
"folder_name": "folder4",
"children": []
},
{
"id": 16,
"folder_name": "folder3",
"children": []
},
{
"id": 17,
"folder_name": "folder2",
"children": []
},
{
"id": 18,
"folder_name": "folder1",
"children": []
}
]
},
{
"id": 6,
"folder_name": "folder1",
"children": []
},
{
"id": 7,
"folder_name": "folder2",
"children": []
},
{
"id": 8,
"folder_name": "folder3",
"children": []
},
{
"id": 9,
"folder_name": "folder4",
"children": []
},
{
"id": 10,
"folder_name": "folder5",
"children": []
}
]
},
{
"id": 3,
"folder_name": "folder2",
"children": []
},
{
"id": 4,
"folder_name": "folder3",
"children": []
},
{
"id": 5,
"folder_name": "folder4",
"children": []
}
]
so my question is how do I check if a resource exists as a child or as a child of a child or even deeper than that. the relationship/tree array is unlimited so I want to check for all possible children.
so if I want to check if id: 24 is a child of id: 1 it should be true as of the data above. and if I want to check if id: 2 is a child of id: 1 if should be true as well but if I check id: 5 is a child of id: 1 it should be false because it is not a child under it.
for those who may want to do something similar. this is was my solution to the problem.
sample data 👇👇 covert to php array
[
{
"id": 1,
"folder_name": "Setswana Material",
"children": [
{
"id": 2,
"folder_name": "Love Materials",
"children": [
{
"id": 11,
"folder_name": "folder54",
"children": [
{
"id": 19,
"folder_name": "folder1",
"children": []
},
{
"id": 20,
"folder_name": "folder2",
"children": []
},
{
"id": 21,
"folder_name": "folder",
"children": []
},
{
"id": 22,
"folder_name": "folder3",
"children": []
},
{
"id": 23,
"folder_name": "folder4",
"children": []
},
{
"id": 24,
"folder_name": "folder5",
"children": []
}
]
},
{
"id": 12,
"folder_name": "folder5",
"children": []
},
{
"id": 13,
"folder_name": "\nfolder5",
"children": []
},
{
"id": 14,
"folder_name": "folder",
"children": []
},
{
"id": 15,
"folder_name": "folder4",
"children": []
},
{
"id": 16,
"folder_name": "folder3",
"children": []
},
{
"id": 17,
"folder_name": "folder2",
"children": []
},
{
"id": 18,
"folder_name": "folder1",
"children": []
}
]
},
{
"id": 6,
"folder_name": "folder1",
"children": []
},
{
"id": 7,
"folder_name": "folder2",
"children": []
},
{
"id": 8,
"folder_name": "folder3",
"children": []
},
{
"id": 9,
"folder_name": "folder4",
"children": []
},
{
"id": 10,
"folder_name": "folder5",
"children": []
}
]
},
{
"id": 3,
"folder_name": "folder2",
"children": []
},
{
"id": 4,
"folder_name": "folder3",
"children": []
},
{
"id": 5,
"folder_name": "folder4",
"children": []
}
]
and the code to get ids from the code
return $resource->pipe(function ($collection) {
$array = $collection->toArray();
$ids = [];
array_walk_recursive($array, function ($value, $key) use (&$ids) {
if ($key === 'id') {
$ids[] = $value;
};
});
return $ids;
});
they results are in the following format
[
2,11,19,20,21,22,23,24,12,13,14,15,16,17,18
]
it gets all the id: fields from the multidimentional array and I tested for depth of up to 8 steps deep in, it is able to get all the id:

Axios response return object instead of array

I am using axios in react native. Original response in postman looks like this:
{
"id": 2,
"parent_id": 1,
"name": "Default Category",
"is_active": true,
"position": 1,
"level": 1,
"product_count": 2,
"children_data": [
{
"id": 3,
"parent_id": 2,
"name": "Papers",
"is_active": true,
"position": 1,
"level": 2,
"product_count": 2,
"children_data": [
{
"id": 5,
"parent_id": 3,
"name": "A44",
"is_active": true,
"position": 1,
"level": 3,
"product_count": 0,
"children_data": []
}
]
},
{
"id": 6,
"parent_id": 2,
"name": "Laptop",
"is_active": true,
"position": 2,
"level": 2,
"product_count": 1,
"children_data": []
}
]
}
How when i try this console.log(typeof categoryResponse.data.children_data);
I get object. This is causing issue as I am trying to update a state variable in react-native of type array. Even the response object which when printed console.log(categoryResponse.data); looks very odd.
Object { "children_data": Array [
Object {
"children_data": Array [
Object {
"children_data": Array [],
"id": 5,
"is_active": true,
"level": 3,
"name": "A44",
"parent_id": 3,
"position": 1,
"product_count": 0,
},
],
"id": 3,
"is_active": true,
"level": 2,
"name": "Papers",
"parent_id": 2,
"position": 1,
"product_count": 2,
},
Object {
"children_data": Array [],
"id": 6,
"is_active": true,
"level": 2,
"name": "Laptop",
"parent_id": 2,
"position": 2,
"product_count": 1,
}, ], "id": 2, "is_active": true, "level": 1, "name": "Default Category", "parent_id": 1, "position": 1,
"product_count": 2, }
Please help
In javascript , typeof array is actually an object. In javascript there are only 6 datatypes. Arrays are subsets of objects , so hence console.log(typeof categoryResponse.data.children_data) returns object even if its an array.
But you can see when you console.log(categoryResponse.data) , you see
Object { "children_data": Array [ Object { "children_data": Array [ Object { "children_data": Array [], "id": 5, "is_active": true, "level": 3, "name": "A44", "parent_id": 3, "position": 1, "product_count": 0, }, ], "id": 3, "is_active": true, "level": 2, "name": "Papers", "parent_id": 2, "position": 1, "product_count": 2, }, Object { "children_data": Array [], "id": 6, "is_active": true, "level": 2, "name": "Laptop", "parent_id": 2, "position": 2, "product_count": 1, }, ], "id": 2, "is_active": true, "level": 1, "name": "Default Category", "parent_id": 1, "position": 1,
"product_count": 2, }
and here you see "childern_data" as an array right.
"children_data": Array [ Object {
so basically its an array, dont let typeof confuse you .
Hope it helps. feel free for doubts, ill clear it

Filled area graph vertical orientation

I am attempting to get a vertical filled area graph, where the area on the left between the y axis and the data line is filled. Essentially, take the normal area graph and rotate it 90 degrees clockwise.
I've basically just taken the example from the vega examples and tried to convert everything to vertical, changed the names of the scales to something more related to the data, and added a line width and colour.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 500,
"height": 500,
"padding": 5,
"signals": [
{
"name": "interpolate",
"value": "linear",
"bind": {
"input": "select",
"options": [
"basis",
"cardinal",
"catmull-rom",
"linear",
"monotone",
"natural",
"step",
"step-after",
"step-before"
]
}
}
],
"data": [
{
"name": "table",
"values": [
{"u": 1, "v": 28}, {"u": 2, "v": 55},
{"u": 3, "v": 43}, {"u": 4, "v": 91},
{"u": 5, "v": 81}, {"u": 6, "v": 53},
{"u": 7, "v": 19}, {"u": 8, "v": 87},
{"u": 9, "v": 52}, {"u": 10, "v": 48},
{"u": 11, "v": 24}, {"u": 12, "v": 49},
{"u": 13, "v": 87}, {"u": 14, "v": 66},
{"u": 15, "v": 17}, {"u": 16, "v": 27},
{"u": 17, "v": 68}, {"u": 18, "v": 16},
{"u": 19, "v": 49}, {"u": 20, "v": 15}
]
}
],
"scales": [
{
"name": "uscale",
"type": "linear",
"range": "height",
"zero": false,
"domain": {"data": "table", "field": "u"}
},
{
"name": "vscale",
"type": "linear",
"range": "width",
"nice": true,
"zero": true,
"domain": {"data": "table", "field": "v"}
}
],
"axes": [
{"orient": "bottom", "scale": "vscale", "tickCount": 25},
{"orient": "left", "scale": "uscale"}
],
"marks": [
{
"type": "area",
"orient": "horizontal",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "vscale", "field": "v"},
"y": {"scale": "uscale", "field": "u"},
"x2": {"scale": "vscale", "value": 0},
"stroke": {"value": "#000000"},
"fill": {"value": "steelblue"}
},
"update": {
"interpolate": {"signal": "interpolate"},
"fillOpacity": {"value": 1}
},
"hover": {
"fillOpacity": {"value": 0.5}
}
}
}
]
}
Pretty sure I'm doing something wrong here. According to the docs "vertical" orientation is the default, and I've tried this with x2 and y2, and orient "vertical" and "horizontal" for both - I've also tried to set the scale as vscale and uscale for x2 and y2.
I get no errors in the vega online editor - The line is correct but I would expect the graph to be filled to the left of the line between the y axis and the graph line. The actual output right now is just a solid line.
The orient property has to go into the encode block.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 500,
"height": 500,
"padding": 5,
"signals": [
{
"name": "interpolate",
"value": "linear",
"bind": {
"input": "select",
"options": [
"basis",
"cardinal",
"catmull-rom",
"linear",
"monotone",
"natural",
"step",
"step-after",
"step-before"
]
}
}
],
"data": [
{
"name": "table",
"values": [
{"u": 1, "v": 28}, {"u": 2, "v": 55},
{"u": 3, "v": 43}, {"u": 4, "v": 91},
{"u": 5, "v": 81}, {"u": 6, "v": 53},
{"u": 7, "v": 19}, {"u": 8, "v": 87},
{"u": 9, "v": 52}, {"u": 10, "v": 48},
{"u": 11, "v": 24}, {"u": 12, "v": 49},
{"u": 13, "v": 87}, {"u": 14, "v": 66},
{"u": 15, "v": 17}, {"u": 16, "v": 27},
{"u": 17, "v": 68}, {"u": 18, "v": 16},
{"u": 19, "v": 49}, {"u": 20, "v": 15}
]
}
],
"scales": [
{
"name": "uscale",
"type": "linear",
"range": "height",
"zero": false,
"domain": {"data": "table", "field": "u"}
},
{
"name": "vscale",
"type": "linear",
"range": "width",
"nice": true,
"zero": true,
"domain": {"data": "table", "field": "v"}
}
],
"axes": [
{"orient": "bottom", "scale": "vscale", "tickCount": 25},
{"orient": "left", "scale": "uscale"}
],
"marks": [
{
"type": "area",
"from": {"data": "table"},
"encode": {
"enter": {
"orient": {"value": "horizontal"},
"x": {"scale": "vscale", "field": "v"},
"y": {"scale": "uscale", "field": "u"},
"x2": {"scale": "vscale", "value": 0},
"stroke": {"value": "#000000"},
"fill": {"value": "steelblue"}
},
"update": {
"interpolate": {"signal": "interpolate"},
"fillOpacity": {"value": 1}
},
"hover": {
"fillOpacity": {"value": 0.5}
}
}
}
]
}

What causes the layout problems of my Datatable?

I am building an app in which I want use Datatables with various plugins and I observed some weird layout-problems. So I tried to build a repro. And as worked on that, new problems occurred and I even failed to sort these out.
So here I am with the current state of my fiddle
I have no idea what's causing these issues. I have attached a bit of code (because it is required, but with reduced data). The issues I'm currently struggling with:
yadcf-Filters incomplete...
footer-defects: pagelength-selector missing, paging-controls missing. Whenever I saw that in the past, there were some JS-Errors (usually with my code), but this time I'm not seeing anything in the console.
Update1: I've now managed to get rid of column1-resizing. The range_number_sliderfor yadcf does not render correctly - am I missing a resource??
Updated fiddle here.
$(function() {
dtObj = $("#dataset").DataTable({
"buttons": [{
"columns": ":gt(1)",
"extend": "colvis",
"text": "Series"
}],
"scrollX": true,
"dom": "Bfrtip",
"lengthMenu": [
[10, 25, 50, -1],
["10 rows", "25 rows", "50 rows", "Show all"]
],
"columns": [{
"data": "_include",
"render": function(data, type, row, meta) {
var res = '';
if (row._include) {
res='<span onclick="toggleRecord(' + row._id + ')"><i class="fal fa-eye"></i></span>';
} else {
res='<span onclick="toggleRecord(' + row._id + ')"><i class="fal fa-eye-slash"></i></span>';
}
return res;
},
"title": "Include",
"visible": true,
"width": "2em;"
}, {
"data": "_id",
"title": "ID",
"visible": false
}, {
"className": "text-right",
"data": "Car",
"title": "Car",
"visible": false,
"width": "80px"
}, {
"data": "Eyes",
"title": "Eyes",
"visible": false,
"width": "80px"
}, {
"className": "text-right",
"data": "Family",
"title": "Family",
"visible": false,
"width": "80px"
}, {
"data": "Hand",
"title": "Hand",
"visible": true,
"width": "80px"
}, {
"className": "text-right",
"data": "HealthCare",
"title": "HealthCare",
"visible": false,
"width": "80px"
}, {
"className": "text-right",
"data": "Height",
"title": "Height",
"visible": true,
"width": "80px"
}, {
"data": "Major",
"title": "Major",
"visible": true,
"width": "80px"
}, {
"className": "text-right",
"data": "Marriage",
"title": "Marriage",
"visible": false,
"width": "80px"
}, {
"data": "Party",
"title": "Party",
"visible": false,
"width": "80px"
}, {
"className": "text-right",
"data": "Pot",
"title": "Pot",
"visible": false,
"width": "80px"
}, {
"data": "Sex",
"title": "Sex",
"visible": false,
"width": "80px"
}, {
"className": "text-right",
"data": "ShoeSize",
"title": "ShoeSize",
"visible": false,
"width": "80px"
}, {
"data": "State",
"title": "State",
"visible": true,
"width": "80px"
}, {
"className": "text-right",
"data": "Student",
"title": "Student",
"visible": false,
"width": "80px"
}, {
"className": "text-right",
"data": "Weight",
"title": "Weight",
"visible": false,
"width": "80px"
}],
"createdRow": function(row, data, dataIndex) {
row.id = 'r' + data._id;
if (!data._include) {
$(row).children(":gt(2)").addClass('excludeRow');
}
},
"data": [{
"Car": 1,
"Eyes": "Blue",
"Family": 3,
"Hand": "R",
"HealthCare": 2,
"Height": 72,
"Major": "FIN",
"Marriage": 5,
"Party": "R",
"Pot": 4,
"Sex": "M",
"ShoeSize": 11.5,
"State": "PA",
"Student": 1,
"Weight": 220,
"_id": 1,
"_include": true
}, {
"Car": 1,
"Eyes": "Brown",
"Family": 4,
"Hand": "R",
"HealthCare": 1,
"Height": 62,
"Major": "ACC",
"Marriage": 1,
"Party": "D",
"Pot": 5,
"Sex": "F",
"ShoeSize": 9,
"State": "PA",
"Student": 2,
"Weight": 140,
"_id": 2,
"_include": true
}, {
"Car": 0,
"Eyes": "Blue",
"Family": 0,
"Hand": "R",
"HealthCare": 3,
"Height": 69,
"Major": "FIN",
"Marriage": 1,
"Party": "D",
"Pot": 4,
"Sex": "M",
"ShoeSize": 11,
"State": "MD",
"Student": 3,
"Weight": 195,
"_id": 3,
"_include": true
}, {
"Car": 1,
"Eyes": "Blue",
"Family": 1,
"Hand": "R",
"HealthCare": 2,
"Height": 69,
"Major": "OIM",
"Marriage": 1,
"Party": "D",
"Pot": 3,
"Sex": "M",
"ShoeSize": 9.5,
"State": "PA",
"Student": 4,
"Weight": 190,
"_id": 4,
"_include": true
}, {
"Car": 1,
"Eyes": "Brown",
"Family": 1,
"Hand": "L",
"HealthCare": 2,
"Height": 70,
"Major": "BA",
"Marriage": 4,
"Party": "R",
"Pot": 5,
"Sex": "M",
"ShoeSize": 10.5,
"State": "CT",
"Student": 5,
"Weight": 150,
"_id": 5,
"_include": true
}, {
"Car": 1,
"Eyes": "Brown",
"Family": 2,
"Hand": "R",
"HealthCare": 4,
"Height": 66,
"Major": "ACC",
"Marriage": 2,
"Party": "R",
"Pot": 3,
"Sex": "M",
"ShoeSize": 8.25,
"State": "NJ",
"Student": 6,
"Weight": 125,
"_id": 6,
"_include": true
}, {
"Car": 0,
"Eyes": "Brown",
"Family": 1,
"Hand": "R",
"HealthCare": 2,
"Height": 67,
"Major": "BA",
"Marriage": 2,
"Party": "D",
"Pot": 4,
"Sex": "M",
"ShoeSize": 9,
"State": "NY",
"Student": 7,
"Weight": 155,
"_id": 7,
"_include": true
}, {
"Car": 1,
"Eyes": "Green",
"Family": 2,
"Hand": "L",
"HealthCare": 1,
"Height": 72,
"Major": "OIM",
"Marriage": 2,
"Party": "I",
"Pot": 4,
"Sex": "M",
"ShoeSize": 13,
"State": "PA",
"Student": 8,
"Weight": 260,
"_id": 8,
"_include": true
}, {
"Car": 1,
"Eyes": "Blue",
"Family": 2,
"Hand": "R",
"HealthCare": 3,
"Height": 72,
"Major": "BA",
"Marriage": 2,
"Party": "R",
"Pot": 4,
"Sex": "M",
"ShoeSize": 10.5,
"State": "NY",
"Student": 9,
"Weight": 155,
"_id": 9,
"_include": true
}, {
"Car": 1,
"Eyes": "Brown",
"Family": 2,
"Hand": "R",
"HealthCare": 3,
"Height": 71,
"Major": "ACC",
"Marriage": 2,
"Party": "D",
"Pot": 4,
"Sex": "M",
"ShoeSize": 12,
"State": "CT",
"Student": 10,
"Weight": 180,
"_id": 10,
"_include": true
}, {
"Car": 1,
"Eyes": "Blue",
"Family": 1,
"Hand": "R",
"HealthCare": 3,
"Height": 71,
"Major": "BA",
"Marriage": 4,
"Party": "R",
"Pot": 2,
"Sex": "M",
"ShoeSize": 11,
"State": "MD",
"Student": 11,
"Weight": 160,
"_id": 11,
"_include": true
}]
});
yadcf.init($("#dataset").DataTable(), [{
"column_number": 0,
"filter_type": "range_number_slider"
}, {
"column_number": 1,
"filter_type": "multi_select",
"select_type": "chosen"
}, {
"column_number": 2,
"filter_type": "range_number_slider"
}, {
"column_number": 3,
"filter_type": "multi_select",
"select_type": "chosen"
}, {
"column_number": 4,
"filter_type": "range_number_slider"
}, {
"column_number": 5,
"filter_type": "range_number_slider"
}, {
"column_number": 6,
"filter_type": "multi_select",
"select_type": "chosen"
}, {
"column_number": 7,
"filter_type": "range_number_slider"
}, {
"column_number": 8,
"filter_type": "multi_select",
"select_type": "chosen"
}, {
"column_number": 9,
"filter_type": "range_number_slider"
}, {
"column_number": 10,
"filter_type": "multi_select",
"select_type": "chosen"
}, {
"column_number": 11,
"filter_type": "range_number_slider"
}, {
"column_number": 12,
"filter_type": "multi_select",
"select_type": "chosen"
}, {
"column_number": 13,
"filter_type": "range_number_slider"
}, {
"column_number": 14,
"filter_type": "range_number_slider"
}]);
});
[1]: https://jsfiddle.net/mbaas/fbo0L88v/
Solved the issues with the Datatable (most notable I did not load the appropriate .css to support Bootstrap for the addons), I then had an issue with the pagelength-control not being wide enough to fully show the text for the "All"-Selection - that required some changes to the CSS which Allan will include in his downloads.
Just in case anyone else hits this:
div.dataTables_wrapper div.dataTables_length select {
width: auto;
}
Then I had an issue with vertical alignment of the controls surrounding the table - that needed a slightly more evolved dom-setting than I had:
"<'row'<'col-sm-12 col-md-6'B><'col-sm-12 col-md-6'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12'i>>" +
"<'row'<'col-sm-12 col-md-5'l><'col-sm-12 col-md-7'p>>"
This should become significantly easier with one the next releases...
Even after sorting all that out, the yadcf-issue remained - but that seems to be a real bug, so I posted an issue on GitHub.

Fail to serialize JSON Objective-c

I have a problem. When I try to make test my json, it says that it is not valid. But when I test it with online services, it reads it well.
The code I use to test if json is valid is:
NSString* stringRes = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
[NSJSONSerialization isValidJSONObject:stringRes];
Where stringRes is son string in NSString format.(From data response)
JSON :
{
"response": [
9,
{
"id": 47,
"from_id": 211551056,
"to_id": -101815039,
"date": 1442585775,
"post_type": "post",
"text": "Кто на андроид кодит хоть немножк ? Хотя бы hello world ?",
"can_edit": 1,
"created_by": 211551056,
"can_delete": 1,
"post_source": {
"type": "api",
"platform": "iphone"
},
"comments": {
"count": 0,
"can_post": 1
},
"likes": {
"count": 0,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 0
},
{
"id": 43,
"from_id": 217702824,
"to_id": -101815039,
"date": 1442555658,
"post_type": "post",
"text": "Учебник по географии",
"can_delete": 1,
"attachment": {
"type": "doc",
"doc": {
"did": 419802605,
"owner_id": 217702824,
"title": "11_geo_m_2012.pdf",
"size": 92318316,
"ext": "pdf",
"url": "http://vk.com/doc217702824_419802605?hash=5eb9bb9753a6f88e88&dl=fcadca27db5845a002&api=1",
"access_key": "8e4218746055687cc2"
}
},
"attachments": [
{
"type": "doc",
"doc": {
"did": 419802605,
"owner_id": 217702824,
"title": "11_geo_m_2012.pdf",
"size": 92318316,
"ext": "pdf",
"url": "http://vk.com/doc217702824_419802605?hash=5eb9bb9753a6f88e88&dl=fcadca27db5845a002&api=1",
"access_key": "8e4218746055687cc2"
}
}
],
"post_source": {
"type": "api",
"platform": "android"
},
"comments": {
"count": 0,
"can_post": 1
},
"likes": {
"count": 3,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 0,
"reply_count": 0
},
{
"id": 37,
"from_id": 211551056,
"to_id": -101815039,
"date": 1442502437,
"post_type": "post",
"text": "У кого айфон, + в комменты",
"can_delete": 1,
"attachment": {
"type": "poll",
"poll": {
"poll_id": 195892301,
"question": "Удобно смотреть расписание ?(На сайте)"
}
},
"attachments": [
{
"type": "poll",
"poll": {
"poll_id": 195892301,
"question": "Удобно смотреть расписание ?(На сайте)"
}
}
],
"post_source": {
"type": "api",
"platform": "iphone"
},
"comments": {
"count": 5,
"can_post": 1
},
"likes": {
"count": 0,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 5
},
{
"id": 36,
"from_id": 249011483,
"to_id": -101815039,
"date": 1442500757,
"post_type": "post",
"text": "Домашку выложить не забудьте 👌👆",
"can_delete": 1,
"post_source": {
"type": "api",
"platform": "iphone"
},
"comments": {
"count": 0,
"can_post": 1
},
"likes": {
"count": 1,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 0
},
{
"id": 28,
"from_id": 211551056,
"to_id": -101815039,
"date": 1442306249,
"post_type": "post",
"text": "",
"can_delete": 1,
"media": {
"type": "photo",
"owner_id": -101815039,
"item_id": 381477357,
"thumb_src": "http://cs624425.vk.me/v624425056/49e35/_w_YDirrrQU.jpg"
},
"attachment": {
"type": "photo",
"photo": {
"pid": 381477357,
"aid": -8,
"owner_id": -101815039,
"user_id": 211551056,
"src": "http://cs624425.vk.me/v624425056/49e35/_w_YDirrrQU.jpg",
"src_big": "http://cs624425.vk.me/v624425056/49e36/439edT8aXks.jpg",
"src_small": "http://cs624425.vk.me/v624425056/49e34/uLxZj9yF1F4.jpg",
"src_xbig": "http://cs624425.vk.me/v624425056/49e37/nhvaG43cV-Y.jpg",
"src_xxbig": "http://cs624425.vk.me/v624425056/49e38/Ox54xM039hg.jpg",
"width": 960,
"height": 720,
"text": "",
"created": 1442306250,
"lat": 55.785025,
"long": 37.706605,
"post_id": 28,
"access_key": "454823aa95a2ee9fbc"
}
},
"attachments": [
{
"type": "photo",
"photo": {
"pid": 381477357,
"aid": -8,
"owner_id": -101815039,
"user_id": 211551056,
"src": "http://cs624425.vk.me/v624425056/49e35/_w_YDirrrQU.jpg",
"src_big": "http://cs624425.vk.me/v624425056/49e36/439edT8aXks.jpg",
"src_small": "http://cs624425.vk.me/v624425056/49e34/uLxZj9yF1F4.jpg",
"src_xbig": "http://cs624425.vk.me/v624425056/49e37/nhvaG43cV-Y.jpg",
"src_xxbig": "http://cs624425.vk.me/v624425056/49e38/Ox54xM039hg.jpg",
"width": 960,
"height": 720,
"text": "",
"created": 1442306250,
"lat": 55.785025,
"long": 37.706605,
"post_id": 28,
"access_key": "454823aa95a2ee9fbc"
}
}
],
"post_source": {
"type": "api",
"platform": "iphone"
},
"comments": {
"count": 0,
"can_post": 1
},
"likes": {
"count": 1,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 0
},
{
"id": 27,
"from_id": 211551056,
"to_id": -101815039,
"date": 1442306164,
"post_type": "post",
"text": "",
"can_delete": 1,
"media": {
"type": "photo",
"owner_id": -101815039,
"item_id": 381477244,
"thumb_src": "http://cs624425.vk.me/v624425056/49e2c/kttj5pUpjTk.jpg"
},
"attachment": {
"type": "photo",
"photo": {
"pid": 381477244,
"aid": -8,
"owner_id": -101815039,
"user_id": 211551056,
"src": "http://cs624425.vk.me/v624425056/49e2c/kttj5pUpjTk.jpg",
"src_big": "http://cs624425.vk.me/v624425056/49e2d/ihg9szTvLew.jpg",
"src_small": "http://cs624425.vk.me/v624425056/49e2b/GpS0xwCa66c.jpg",
"src_xbig": "http://cs624425.vk.me/v624425056/49e2e/pe4tflJokqs.jpg",
"src_xxbig": "http://cs624425.vk.me/v624425056/49e2f/7vkU8nUyNxc.jpg",
"width": 960,
"height": 720,
"text": "",
"created": 1442306166,
"lat": 55.785083,
"long": 37.711116,
"post_id": 27,
"access_key": "cb01ac011f4abbc0af"
}
},
"attachments": [
{
"type": "photo",
"photo": {
"pid": 381477244,
"aid": -8,
"owner_id": -101815039,
"user_id": 211551056,
"src": "http://cs624425.vk.me/v624425056/49e2c/kttj5pUpjTk.jpg",
"src_big": "http://cs624425.vk.me/v624425056/49e2d/ihg9szTvLew.jpg",
"src_small": "http://cs624425.vk.me/v624425056/49e2b/GpS0xwCa66c.jpg",
"src_xbig": "http://cs624425.vk.me/v624425056/49e2e/pe4tflJokqs.jpg",
"src_xxbig": "http://cs624425.vk.me/v624425056/49e2f/7vkU8nUyNxc.jpg",
"width": 960,
"height": 720,
"text": "",
"created": 1442306166,
"lat": 55.785083,
"long": 37.711116,
"post_id": 27,
"access_key": "cb01ac011f4abbc0af"
}
}
],
"post_source": {
"type": "api",
"platform": "iphone"
},
"comments": {
"count": 0,
"can_post": 1
},
"likes": {
"count": 1,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 0
},
{
"id": 16,
"from_id": 249011483,
"to_id": -101815039,
"date": 1442069345,
"post_type": "post",
"text": "Кто нибудь сделал алгебру ?",
"can_delete": 1,
"post_source": {
"type": "api",
"platform": "iphone"
},
"comments": {
"count": 6,
"can_post": 1
},
"likes": {
"count": 3,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 6
},
{
"id": 9,
"from_id": 127082413,
"to_id": -101815039,
"date": 1441911418,
"post_type": "post",
"text": "Официальная информациия ,староста нашей группы Александр Кондор!",
"can_delete": 1,
"post_source": {
"type": "api",
"platform": "android"
},
"comments": {
"count": 6,
"can_post": 1
},
"likes": {
"count": 2,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 6
},
{
"id": 1,
"from_id": -101815039,
"to_id": -101815039,
"date": 1441656588,
"post_type": "post",
"text": "",
"can_delete": 1,
"can_pin": 1,
"media": {
"type": "photo",
"owner_id": -101815039,
"item_id": 380592775,
"thumb_src": "http://cs629111.vk.me/v629111548/e99f/DcV1yHZK1fw.jpg"
},
"attachment": {
"type": "photo",
"photo": {
"pid": 380592775,
"aid": -6,
"owner_id": -101815039,
"user_id": 100,
"src": "http://cs629111.vk.me/v629111548/e99f/DcV1yHZK1fw.jpg",
"src_big": "http://cs629111.vk.me/v629111548/e9a0/Qf8q8PpH7Jg.jpg",
"src_small": "http://cs629111.vk.me/v629111548/e99e/2Jq8e-0SptQ.jpg",
"src_xbig": "http://cs629111.vk.me/v629111548/e9a1/Uha0MvOoVCU.jpg",
"src_xxbig": "http://cs629111.vk.me/v629111548/e9a2/v8hqUldA6Kk.jpg",
"width": 730,
"height": 1024,
"text": "",
"created": 1441656588,
"post_id": 1
}
},
"attachments": [
{
"type": "photo",
"photo": {
"pid": 380592775,
"aid": -6,
"owner_id": -101815039,
"user_id": 100,
"src": "http://cs629111.vk.me/v629111548/e99f/DcV1yHZK1fw.jpg",
"src_big": "http://cs629111.vk.me/v629111548/e9a0/Qf8q8PpH7Jg.jpg",
"src_small": "http://cs629111.vk.me/v629111548/e99e/2Jq8e-0SptQ.jpg",
"src_xbig": "http://cs629111.vk.me/v629111548/e9a1/Uha0MvOoVCU.jpg",
"src_xxbig": "http://cs629111.vk.me/v629111548/e9a2/v8hqUldA6Kk.jpg",
"width": 730,
"height": 1024,
"text": "",
"created": 1441656588,
"post_id": 1
}
}
],
"post_source": {
"type": "api",
"platform": "android",
"data": "profile_photo"
},
"comments": {
"count": 0,
"can_post": 1
},
"likes": {
"count": 0,
"user_likes": 0,
"can_like": 1,
"can_publish": 0
},
"reposts": {
"count": 0,
"user_reposted": 0
},
"online": 1,
"reply_count": 0
}
]
}
UPD: Solved by using
NSData* data = [stringRes dataUsingEncoding:NSUTF8StringEncoding];
isValidJSONObject tests if a JSON object (a NSDictionary or NSArray) can be successfully converted to JSON data.
It is not for testing if an NSData object contains valid JSON data. To test for valid JSON data you just call
[NSJSONSerialization JSONObjectWithData:data ...]
and check if the return value is nil or not.