JSON syntax error - syntax-error

{
"manifest_version" : 2,
"name": "kittenbook",
"description" : "Replace photos on Facebook with kittens",
"version": "0.0.1"
"content_scripts": [
{
"matches": ["*://www.facebook.com/*"],
"js": [kittenbook.js"]
}
}
Can someone explain to me what is wrong with this?
Failed to load extension from: ~\kittenbook.html Manifest is not valid
JSON. Line: 6, column: 3, Syntax error.

You have 3 errors here.
at the end of "version":"0.0.1" << missing ,
at the end of "js":[kittenbook.js"] << missing " and the start of the string
also missing closing [] on the "content_scripts" :[
This is the correct JSON syntaxis.
{
"manifest_version": 2,
"name": "kittenbook",
"description": "Replace photos on Facebook with kittens",
"version": "0.0.1",
"content_scripts": [
{
"matches": [
"://www.facebook.com/"
],
"js": [
"kittenbook.js"
]
}
]
}
For future testing use JSONLint

Related

routes[0].headers is not a object in vercel.json

I have been trying to deploy an a Flask API to vercel and I am getting error that routes[0].header should be an object.
I am a beginner and trying to figure this out, any help is appreciated
my vercel.json is
`
{
"version": 2,
"builds": [
{
"src": "./index.py",
"use": "#vercel/python"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/",
"headers": [
{
"key": "access-control-allow-origin",
"value": "*"
}
]
}
]
}
`
i deployed earlier without headers and it deployed successfully but it was giving me CORS error then i addded the headers and now it is giving me a new error that headers is not a object.
i tried a few different methods but i still can not figure this out
I encountered similar issue and after going through vercel documents https://vercel.com/guides/how-to-enable-cors and few different tries, this worked for me:
The header has to be its own key for specifying access-control-allow-origin and "routes" will need to be replaced with "rewrite" as header and route keys don't go together. And If there are few different domains for your app, you need to duplicate header object within the outer header array for each path for access control origin issue.
Eg:
{
"version": 2,
"builds": [
{
"src": "./index.py",
"use": "#vercel/python"
}
],
"rewrites": [
{ "source": "/(.*)", "destination": "src/app.js" }
],
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Origin", "value": "*" }
]
},
{
"source": "/vercel_app_domain_name/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Origin", "value": "*" }
]
}
]
}

How to convert convert manifest.json verison 2 to manifest.json verison 3?

I am trying to convert my manifest.json version 2 to version 3 for a chrome extension that I'm making but I'm having some issues.
I have followed the tips here https://developer.chrome.com/docs/extensions/mv3/mv3-migration/ but I am still getting error message when I try to load unpack my extension in chrome://extensions.
I greatly appreciate any help or advice!
Here is the error message I am getting:
File
~\tensorflow-toxicity-chrome-extension
Error
Could not load options page 'options.html'.
Could not load manifest.
Here is my manifest.json:
"manifest_version": 3,
"name": "tensorflow-toxicity-chrome-extension",
"description": "Tensorflow Toxicity Chrome Extension ",
"version": "1.0",
"options_ui": {
"page": "options.html"
},
"action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["js/vendor.js", "js/content_script.js", "toxicity/main.js"]
}
],
"background": {
"service_worker": "js/background.js"
},
"permissions": ["storage", "<all_urls>"]
}

Search including special characters in MongoDB Atlas

I faced with the issue when I try to search for several words including a special character (section sign "§").
Example: AB § 32.
I want all words "AB", "32" and symbol "§" to be included in found documents.
In some cases document can be found, in some not.
If my document contains the following text then search finds it:
Lagrum: 32 § 1 mom. första stycket a) kommunalskattelagen (1928:370) AB
But if document contains this text then search doesn't find:
Lagrum: 32 § 1 mom. första stycket AB
For symbol "§" I use UT8-encoding "\xc2\xa7".
Index uses "lucene.swedish" analyzer.
"Content": [
{
"analyzer": "lucene.swedish",
"minGrams": 4,
"tokenization": "nGram",
"type": "autocomplete"
},
{
"analyzer": "lucene.swedish",
"type": "string"
}
]
Query looks like:
{
"index": "test_index",
"compound": {
"filter": [
{
"text": {
"query": [
"111111111111"
],
"path": "ProductId"
}
},
],
"must": [
{
"autocomplete": {
"query": [
"AB"
],
"path": "Content"
}
},
{
"autocomplete": {
"query": [
"\xc2\xa7",
],
"path": "Content"
}
},
{
"autocomplete": {
"query": [
"32"
],
"path": "Content"
}
}
],
},
"count": {
"type": "lowerBound",
"threshold": 500
}
}
The question is what is wrong with the search and how can I get a correct result (return both above mentioned documents) ?
Focusing only on the content field, here is an index definition that should work for your requirements. The docs are here. Let me know if this works for you.
{
"mappings": {
"dynamic": false,
"fields": {
"content": [
{
"type": "autocomplete",
"tokenization": "nGram",
"minGrams": 4,
"maxGrams": 7,
"foldDiacritics": false,
"analyzer": "lucene.whitespace"
},
{
"analyzer": "lucene.swedish",
"type": "string"
}
]
}
}
}

VEGA Sunburst highlight current node and parent path

I am trying to highlight node and all linked parents when we hover with a mouse.
So I ask VEGA : " is my datum.currentNode of my arc mark a parent of my currently hovered node ?"
{
"name": "hoveredArcDetail",
"on": [
{"trigger": "hoveredArcIn", "toggle": "hoveredArcIn"},
{"trigger": "hoveredText", "toggle": "hoveredText"}
],
"transform": [
{"type": "flatten", "fields": ["myTreeAncestorList"]},
{
"type": "formula",
"expr": "datum.myTreeAncestorList.currentNodeAndAncestors",
"as": "nodeToCheckIfParentOfCurrentNode"
}
]
},
"fillOpacity": [
{
"test": "indata('hoveredTextDetail','nodeToCheckIfParentOfCurrentNode',datum.currentNodeAndAncestors)||indata('hoveredArcDetail','nodeToCheckIfParentOfCurrentNode',datum.currentNodeAndAncestors)",
"value": 1
},
{
"test": "((isHoveredOnArc==true)||(isHoveredOnText==true))&&!indata('hoveredArcDetail','nodeToCheckIfParentOfCurrentNode',datum.currentNodeAndAncestors)",
"value": 0.5
}
]
Yet the problem is that, when my toggle trigger empties my data when we don't hoover, my transform flatten and formula throws me an error ( as expected ) saying that we cant find such data.
Does anyone have an idea to handle this error ? Thank you !
Full spec is available here
https://vega.github.io/editor/#/gist/ab2b39162b7c3240aa2cbe84d42aa6fb/spec.json
The issue has been solved by setting interactivity for text mark as false:
{
"type": "text",
"from": {
"data": "nodeLabels"
},
"interactive":false

MFP 8 - error parsing JSON object when using MobileFirst Push API

I am getting the following error when I tried to used the push API to send a notification. The JSON object works in version V7.1
{
"code": "FPWSE0011E",
"message": "Bad Request - The JSON validation failed at 'target'.",
"productVersion": "8.0.0.00-20161122-1902"
}
Here is my JSON object
{
"message": {
"alert": "hello"
},
"settings": {
"apns": {
"badge": 1,
"iosActionKey": "Ok",
"payload": {
"messageType": "HELLO",
"detail": "Here's your message details."
},
"sound": "song.mp3"
},
"gcm": {
"payload": {},
"sound": "song.mp3"
}
},
"target": {
"consumerIds": [],
"deviceIds": ["4A1086CF-873A-4404-BE2D-200EA6BDA8AD"],
"platforms": [
"A","G"
]
}
}
I am using the admin RestAPi interface
https://myserver/mfpadmin/management-apis/2.0/runtimes/mfp/notifications/applications/com.myjobs/messages
I followed the format from the documentation
http://www.ibm.com/support/knowledgecenter/SSHS8R_8.0.0/com.ibm.worklight.apiref.doc/apiref/r_restapi_send_message_post.html
Thanks for your help
According to the v8.0 documentation only 1 property is allowed in target. In your JSON I see several properties are defined.
See example JSON here: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/#sending-notifications
And as can be seen:
target" : {
// The list below is for demonstration purposes only - per the documentation only 1 target is allowed to be used at a time.
"deviceIds" : [ "MyDeviceId1", ... ],
"platforms" : [ "A,G", ... ],
"tagNames" : [ "Gold", ... ],
"userIds" : [ "MyUserId", ... ],
},