JSON file shows parse error, but everything looks fine (JSON, AngularJS) - angularjs

I'm working with a JSON file that was sent to me. I keep getting a parse error on line 7 (begins with "overview) of this JSON file. The error reads: Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
I ran the JSON through JSONLint and got the same message. What's going on here? You can see the file below (I've only included the beginning here, since it's long. I tried removing the entry that causes the error to see if it was a random thing, but the "overview" name causes the same error on the next entry as well). Any thoughts would be very helpful!
{
"page": 1,
"results": [{
"poster_path": "\/il9XWx5CbNd2KdDUwrcClEZiLkv.jpg",
"adult": false,
"overview": "Last months of World War II in April 1945. As the Allies make their final push in the European Theater,
a battle - hardened U.S.Army sergeant in the 2 nd Armored Division named Wardaddy commands a Sherman tank called Fury and its five - man crew on a deadly mission behind enemy lines.Outnumbered and outgunned,
Wardaddy and his men face overwhelming odds in their heroic attempts to strike at the heart of Nazi Germany.
",
"release_date": "2014-10-15",
"genre_ids": [10752,
18,
28
],
"id": 228150,
"original_title": "Fury",
"original_language": "en",
"title": "Fury",
"backdrop_path": "\/pKawqrtCBMmxarft7o1LbEynys7.jpg",
"popularity": 11.717304,
"vote_count": 2435,
"video": false,
"vote_average": 7.43
// more entries with the same name/value pairs... same error for next entry
// when I get to the "overview" name.
}],
"total_results": 70,
"total_pages": 4
}

don't use comments
don't break the lines (String Values) - "overview" property;
{
"page": 1,
"results": [{
"poster_path": "\/il9XWx5CbNd2KdDUwrcClEZiLkv.jpg",
"adult": false,
"overview": "Last months of World War II in April 1945. As the Allies make their final push in the European Theater, a battle - hardened U.S.Army sergeant in the 2 nd Armored Division named Wardaddy commands a Sherman tank called Fury and its five - man crew on a deadly mission behind enemy lines.Outnumbered and outgunned, Wardaddy and his men face overwhelming odds in their heroic attempts to strike at the heart of Nazi Germany.",
"release_date": "2014-10-15",
"genre_ids": [10752,
18,
28
],
"id": 228150,
"original_title": "Fury",
"original_language": "en",
"title": "Fury",
"backdrop_path": "\/pKawqrtCBMmxarft7o1LbEynys7.jpg",
"popularity": 11.717304,
"vote_count": 2435,
"video": false,
"vote_average": 7.43
}],
"total_results": 70,
"total_pages": 4
}

Related

How to see BACnet scrape data on volttron.log

Can someone give me a tip on how see the BACnet scrape data on the VOLTTRON .log?
Would this have anything to do with the log level? Maybe I just cant see any data because of incorrect log levels? Any tips setting the log level appropriate greatly appreciated.
vctl config get platform.driver devices/201201
returns this:
{
"driver_config": {
"device_address": "12345:2",
"device_id": 201201
},
"driver_type": "bacnet",
"interval": 60,
"registry_config": "config://registry_configs/201201.csv"
}
Running:
vctl config get platform.driver registry_configs/201201.csv
Looks good I can see all of the device points that were discovered:
{
"Reference Point Name": "Oat",
"Volttron Point Name": "Oat",
"Units": "degreesFahrenheit",
"Unit Details": "",
"BACnet Object Type": "analogValue",
"Property": "presentValue",
"Writable": "FALSE",
"Index": "301",
"Write Priority": "",
"Notes": ""
},
{
"Reference Point Name": "RmTmpSpt",
"Volttron Point Name": "RmTmpSpt",
"Units": "degreesFahrenheit",
"Unit Details": "",
"BACnet Object Type": "analogValue",
"Property": "presentValue",
"Writable": "FALSE",
"Index": "302",
"Write Priority": "",
"Notes": ""
},
{
"Reference Point Name": "RmTmp",
"Volttron Point Name": "RmTmp",
"Units": "degreesFahrenheit",
"Unit Details": "",
"BACnet Object Type": "analogValue",
"Property": "presentValue",
"Writable": "FALSE",
"Index": "300",
"Write Priority": "",
"Notes": ""
}
Running a vctl status and even restarting UUID a and 4 doesnt seem to do anything.
UUID AGENT IDENTITY TAG STATUS HEALTH
a bacnet_proxyagent-0.5 platform.bacnet_proxy proxy running [73753] GOOD
4 platform_driveragent-4.0 platform.driver platform_driver running [73754] GOOD
6 simplewebagent-0.1 webagent simpleWebAgent
Also the BACpypes.ini has the proper ID address set for the IP address of the computer running VOLTTRON.
Any tips appreciated.
Generall you won't want all of the data going through the message bus in the log as that will make your log huge and fill up the system.
However, if you install and start a listener agent you will get that behaviour. A listener agent will write to the log everything that goes through the message bus. It is located in the examples/ListenerAgent from the volttron repository.

Is there anyway to store folder Content in a .JSON file variable?

i am completely new to JSON and Java in General.
i have a Task with a similar Block of code:
{
"name": "Chew Barka",
"breed": "Bichon",
"age": "2 years",
"weight": 8,
"bio": "The park, The pool or the Playground - I love to go anywhere!",
"filename": ""
},
And i would like to have the Contents of the folder:
"C:/Temp" for example
Stored in "filename"
so that when i call "filename" i get the "C:/Temp" Content

Translating JSON file with Angular Gettext

I am using gettext to translate my AngularJS site - it all works fine where I have HTML attributes that I can add 'translate' to.
However I also have quite a large and complex JSON file which needs translating, which includes arrays and objects.
Is there any way to include this in the translation that gettext does, into the PO file? Or would I need to rethink the whole idea of using a JSON file to segment the customer flow?
I have included an initial extract of the JSON file below
{
"version": "1.1",
"name": "MVP",
"description": "Initial customer segmenting flow",
"enabled": true,
"funnel": [
{
"text": "I am...",
"image": "",
"help": "",
"options": [
{
"text": "Placing an order",
"image": "image1.png",
"next": 2
},
{
"text": "E-mailing customer service",
"image": "image2.png",
"next": 2
},
Thanks
James
Process the HTML file yourself with a script at build-time and dump all translatable messages into a dummy source file with the syntax expected by your string extractor, probably something like this:
<translate>I am ...</translate>
<translate>Placing an order</translate>
<translate>E-mailing customer service</translate>

unknown command error while posting files to solr

I am trying to post the following json format of the file to solr
{"userName": "Bill", "stars": 4, "review_id": "-TsVN230RCkLYKBeLsuz7A", "type": "review", "business_name": "Eric Goldberg, MD", "user_id": "zvJCcrpm2yOZrxKffwGQLA", "text": "Dr. Goldberg has been my doctor for years and I like him. I've found his office to be fairly efficient. Today I actually got to see the doctor a few minutes early! \n\nHe seems very engaged with his patients and his demeanor is friendly, yet authoritative. \n\nI'm glad to have Dr. Goldberg as my doctor."}
However I get the error
Response: {"responseHeader":{"status":400,"QTime":32}," error":{"msg":"Unknown command 'user_name' at [12]","code":400}}
while I am trying to do
post.sh -c coreName fileName.json
This is driving me crazy. I have unloaded the core and created it again to see if previous attempts to post files is causing this error. But that did not help.
Solr is looking for a command (like 'add') when you send an object, so you need to either add the command, as such:
{"add": {"doc":{"userName": "Bill", "stars": 4, "review_id": "-TsVN230RCkLYKBeLsuz7A", "type": "review", "business_name": "Eric Goldberg, MD", "user_id": "zvJCcrpm2yOZrxKffwGQLA", "text": "Dr. Goldberg has been my doctor for years and I like him. I've found his office to be fairly efficient. Today I actually got to see the doctor a few minutes early! \n\nHe seems very engaged with his patients and his demeanor is friendly, yet authoritative. \n\nI'm glad to have Dr. Goldberg as my doctor."}}}
Or place it in an array:
[{"userName": "Bill", "stars": 4, "review_id": "-TsVN230RCkLYKBeLsuz7A", "type": "review", "business_name": "Eric Goldberg, MD", "user_id": "zvJCcrpm2yOZrxKffwGQLA", "text": "Dr. Goldberg has been my doctor for years and I like him. I've found his office to be fairly efficient. Today I actually got to see the doctor a few minutes early! \n\nHe seems very engaged with his patients and his demeanor is friendly, yet authoritative. \n\nI'm glad to have Dr. Goldberg as my doctor."}]
See also: https://wiki.apache.org/solr/UpdateJSON

Solr gives different querynorm for the same query

I am using Solr for searching institutions... My Solr DB has around 400k documents each of which has multiple fields like ("name","id","city",...)...
A document in my DB looks like this:
"docs":
{
"id": "91348",
"p_code": "71637",
"name": "University of Toronto - Mississauga",
"ext_name": "",
"city": "Mississauga",
"country": "CA",
"state": "ON",
"type": "academic/campus",
"alt_name": "",
"ext_city": "",
"zip": "L5L 1C6",
"alt_ext_city": "",
}
I write a query like {name: (university of toronto)}... Top two matches are:
"docs":
{
"id": "91348",
"p_code": "71637",
"name": "University of Toronto - Mississauga",
"ext_name": "",
"city": "Mississauga",
"country": "CA",
"state": "ON",
"type": "academic/campus",
"alt_name": "",
"ext_city": "",
"zip": "L5L 1C6",
"alt_ext_city": "",
"_version_": 1473710223400108000,
"score": 1.499069
},
{
"id": "10624",
"p_code": "7938",
"name": "University of Toronto",
"ext_name": "",
"city": "Toronto",
"country": "CA",
"state": "ON",
"type": "academic",
"alt_name": "Saint George Downtown Campus",
"ext_city": "",
"zip": "M5S 1A1",
"alt_ext_city": "",
"_version_": 1473710220148473900,
"score": 1.4967358
}
I am really surprised to see that "University of Toronto - Mississauga" returns a higher score than "university of Toronto". Intuitively, the field containing "University of Toronto - Mississauga" should get a lower score since it is longer than the other one.
I was also very surprised to see that Solr gives different values for querynorm as follows:
(0.03198291 = queryNorm) for the top document and (0.03203078 = queryNorm) for the second ranked document. I presumed that the query norm should be exactly the same for the all documents as it is only a function of the query.
I am not sure if I got something wrong about how Solr works or there is something wrong in indexing or configuration? Has anybody faced the same problem?
Make sure that omitNorms is set to false for that field and that your collection is using the latest version of the schema. Then re-index all of your documents for the change to the field to take effect.
I've found that some schema modifications are best treated with a complete wipe of the index prior to indexing in new content. I am not sure, but I believe this may be one of them. For most of the changes you can just re-index all of your content and overwrite the old stuff.

Resources