=============== MyManualController.php ===============
$mCC = $this->getDoctrine()->getManager();
$qCC = "CONFLICT QUERY HERE...";
$xCC = $mCC->getConnection()->prepare($qCC);
$xCC->execute();
$sCC =
$xCC->fetchAll();
=============== Current Output ===============
[{
"emp_name": "Sample"
"adjustment": "0",
"by_days": "10",
"mos": "323",
"by_mos": "0",
"yrs": "27",
"by_yrs": "0"
}]
=============== Expected Output ===============
[{
"emp_name": "Sample"
"adjustment": 0,
"by_days": 10,
"mos": 323,
"by_mos": 0,
"yrs": 27,
"by_yrs": 0
}]
follow link https://symfony.com/doc/current/doctrine.html
you can create entity, or, follow doc for create manually class with example
Related
Suppose we have a structure:
{
"nested_items": [
{
"nested_sample0": "1",
"nested_sample1": "test",
"nested_sample2": "test",
"nested_sample3": {
"type": "type"
},
"nested_sample": null
},
{
"nested_sample0": "1",
"nested_sample1": "test",
"nested_sample2": "test",
"nested_sample3": {
"type": "type"
},
"nested_sample1": null
},
...
],
"sample1": 1233,
"id": "ed68ca34-6b59-4687-a557-bdefc9ec2f4b",
"sample2": "",
"sample3": "test",
"sample4": "test",
"_ts": 1656503348
}
I want to retrieve documents by id by with limit of "nested_items" field .As I know limit and offset not supported in sub queries. Any way to do this except of divide into two queries? Maybe some udf or else?
You can use the function ARRAY_SLICE assuming the array is ordered.
Example data:
{
"name": "John",
"details": [
{
"id": 1
},
{
"id": 2
},
{
"id": 3
}
]
}
Example queries
-- First 2 items from nested array
SELECT c.name, ARRAY_SLICE(c.details, 0, 2) as details
FROM c
-- Last 2 items from nested array
SELECT c.name, ARRAY_SLICE(c.details, ARRAY_LENGTH(c.details) - 2, 2) as details
FROM c
I'm trying to limit the journald logs my vector config picks up but it appears not to work. There are no error messages. Vector is sending all logs to loki. The vector version is 0.22.2.
Here is my vector.toml file:
[sources.host_journald_source]
type = "journald"
current_boot_only = true
[transforms.host_journald_filter]
type = "filter"
inputs = ["host_journald_source"]
condition = '''
includes(["0", "1", "2", "3", "4"], .PRIORITY)
'''
Here is an example of a log I want to exclude in my grafana loki datasource explorer:
Log labels
boot_id 7d16b8f4fc2a4366b9e705f52b75979e
cmdline /sbin/init
host myhost-test
message run-docker-runtime\x2drunc-moby-3995a89e568b3d38fd01a158b8bfd5e02e27b05c60c128aed8a71ed121b44c07-runc.t7aKhj.mount: Deactivated successfully.
Detected fields
CODE_FILE "src/core/unit.c"
CODE_FUNC "unit_log_success"
CODE_LINE "5553"
INVOCATION_ID "e5b739ebc26a4897bd1288844a875d10"
MESSAGE_ID "7ad2d189f7e94e70a38c781354912448"
PRIORITY "6"
SYSLOG_FACILITY "3"
SYSLOG_IDENTIFIER "systemd"
TID "1"
Time 1655917978170
UNIT "run-docker-runtime\\x2drunc-moby-3995a89e568b3d38fd01a158b8bfd5e02e27b05c60c128aed8a71ed121b44c07-runc.t7aKhj.mount"
_BOOT_ID "7d16b8f4fc2a4366b9e705f52b75979e"
_CAP_EFFECTIVE "1ffffffffff"
_CMDLINE "/sbin/init"
_COMM "systemd"
_EXE "/usr/lib/systemd/systemd"
_GID "0"
_MACHINE_ID "fff69d4a6e8643678404cfa6b346143b"
_PID "1"
_SELINUX_CONTEXT "unconfined\n"
_SOURCE_REALTIME_TIMESTAMP "1655917978170117"
_SYSTEMD_CGROUP "/init.scope"
_SYSTEMD_SLICE "-.slice"
_SYSTEMD_UNIT "init.scope"
_TRANSPORT "journal"
_UID "0"
__MONOTONIC_TIMESTAMP "35722646432"
__REALTIME_TIMESTAMP "1655917978172193"
host "myhost-test"
labels [object Object]
message "run-docker-runtime\\x2drunc-moby-3995a89e568b3d38fd01a158b8bfd5e02e27b05c60c128aed8a71ed121b44c07-runc.t7aKhj.mount: Deactivated successfully."
source_type "journald"
tsNs 1655917978170117000
My vector.toml file now looks like this:
[sources.host_journald_source]
type = "journald"
current_boot_only = true
since_now = true
include_units = [ "systemd" ]
include_matches.PRIORITY = [ "0", "1", "2", "3", "4" ]
[sinks.loki]
type = "loki"
inputs = [ "host_journald_source" ]
endpoint = "http://localhost:3100"
compression = "none"
request.concurrency = "adaptive"
out_of_order_action = "accept"
[sinks.loki.labels]
boot_id = '{{ "_BOOT_ID" }}'
message = "{{ message }}"
cmdline = '{{ "_CMDLINE" }}'
host = "{{ host }}"
user_unit = '{{ "USER_UNIT" }}'
[sinks.loki.encoding]
codec = "json"
With the following inputs:
# file1.json
{
"uid": "1",
"name": "jack"
}
{
"uid": "2",
"name": "jill"
}
# file2.json
{
"fid": "a",
"file": "sample1.txt",
"uid": "1"
}
{
"fid": "b",
"file": "sample2.txt",
"uid": "1"
}
{
"fid": "c",
"file": "sample3.txt",
"uid": "2"
}
How do I go about inserting the name key-value pair to the object in the file2.json. The output I'm trying to get is as follows:
{
"fid": "a",
"file": "sample1.txt",
"uid": "1",
"name": "jack"
}
{
"fid": "b",
"file": "sample2.txt",
"uid": "1",
"name": "jack"
}
{
"fid": "c",
"file": "sample3.txt",
"uid": "2",
"name": "jill"
}
Solutions posted on merge json objects with jq and join two json files based on common key with jq utility or alternative way from command line both seems to only return the last matching pair. See below.
{"uid":"1","name":"jack","fid":"b","file":"sample2.txt"}
{"uid":"2","name":"jill","fid":"c","file":"sample3.txt"}
You will need to "slurp" file1.json, e.g. by invoking jq as follows:
jq -n -f merge.jq --slurpfile file1 file1.json file2.json
where merge.jq contains:
INDEX($file1[]; .uid) as $dict
| inputs
| . + $dict[.uid]
def INDEX
If your jq does not have INDEX/2, then simply add its def:
def INDEX(stream; idx_expr):
reduce stream as $row ({}; .[$row|idx_expr|tostring] = $row);
Let's say I have a conversation services configured in IBM Watson ready to recognize a number given in words and in pieces. For example, if I have the number 1320, it can be sent as thirteen twenty or thirteen two zero, etc.
In the first case I'll get something like this from a conversation service:
{
// ...
"entities": [
{
"entity": "sys-number",
"location": [
0,
5
],
"value": "13",
"confidence": 1,
"metadata": {
"numeric_value": 13
}
},
{
"entity": "sys-number",
"location": [
6,
12
],
"value": "20",
"confidence": 1,
"metadata": {
"numeric_value": 20
}
}
]
// ...
}
In the second case (thirteen two zero):
{
// ...
"entities": [
{
"entity": "sys-number",
"location": [
0,
5
],
"value": "13",
"confidence": 1,
"metadata": {
"numeric_value": 13
}
},
{
"entity": "sys-number",
"location": [
6,
14
],
"value": "2",
"confidence": 1,
"metadata": {
"numeric_value": 2
}
}
]
// ...
}
The big question here is: Where is my zero?
I know this question has been asked more than once, but none of the answers I found solved my current issues.
I've seen examples where a regular expression could be used, but that's for actual numbers, here I have words and Watson is the one who actually guesses the number.
Is there a way to obtain a third entry in my entities for that zero? or another work arround? or configuration I may be lacking?
I just tried this in Watson Assistant and it now gets the zero. With #sys-numbers enabled my utterance is thirteen two zero and I get these entities back:
entities: [
0: {
entity: "sys-number",
location: [0, 8],
value: "13",
confidence: 1,
metadata: {numeric_value: 13}
}
1: {
entity: "sys-number",
location: [9, 12],
value: "2",
confidence: 1,
metadata: {numeric_value: 2}
}
2: {
entity: "sys-number",
location: [13, 17],
value: "0",
confidence: 1,
metadata: {numeric_value: 0}
}
]
It might be the entities matching has been improved.
In QML I have a QComboBox:
ComboBox {
id: myCBox
model: [ "1.5", "2", "2.5", "3", "3.5", "4", "5", "6", "7", "8", "9" ]
}
When I try to find an element in the ComboBox by text it returns -1.
Log with this:
console.log(myCBox.find("5"))
And it outputs -1 (which means not found).
QML QComboBox documentation
You should check, when do you the call myCBox.find, look at this code:
ComboBox {
id: myCBox
model: [ "1.5", "2", "2.5", "3", "3.5", "4", "5", "6", "7", "8", "9" ]
Component.onCompleted: {
console.log("After this line it should work fine.");
}
Item {
Component.onCompleted: {
console.log("myCBox is not completed:", myCBox.find("5"));
}
}
}
Component.onCompleted: {
console.log("myCBox here must be completed:", myCBox.find("5"));
}
and the output:
myCBox is not completed: -1
After this line it should work fine.
myCBox must be completed: 6
Uppon creation, Component creates all items and then arranging them in a tree. From the most inner object, it updates properties and bindings to the most overrided value and calls attached method Component.onCompleted.