Can't change VS Code Settings: problem with Json file - json

When ever I try to change a setting in VS Code it shows an error saying "unable to write into user settings".
When I open the JSON file in VS Code it shows there is an error but I cannot seem to find it since I have no idea how JSON works.... Below is all the code in my settings file:
{
"window.zoomLevel": -1,
"editor.fontSize": 26,
"editor.tabSize": 1,
"files.autoSave": "off",
"editor.wordWrap": "on",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
}
"highlight-matching-tag.styles": {
"opening": {
"left": {
"custom": {
"borderWidth": "0 0 0 5px",
"borderStyle": "Solid",
"borderColor": "Yellow",
"borderRadius": "5px",
"overviewRulerColor": "white"
}
},
"right": {
"custom": {
"borderWidth": "0 5px 0 0",
"borderStyle": "Solid",
"borderColor": "Yellow",
"borderRadius": "5px",
"overviewRulerColor": "white"
}
}
}
}
"prettier.singleQuote": true
EDIT: I managed to solve it when I realised that JSON are just stringified JS objects and that VS code only allows single object JSON (not sure if multiple object JSON is even a thing). Basically I neded to move everything into the first {} which is where the official VS code settings are stored (i.e the ones outside were put there by the plugins for some reason).

I also do not know much about JSON. But I know there are online validators like this one: https://jsonlint.com/.
In the line "editor.formatOnSave": true, remove the ,. It could also be the case that VS Code does not like multiple root elements in its JSON - for that you could try to add { as the first and } as the last character of the file (no guarantee).

The settings.json file is 1 dictionary of keys
{
"window.zoomLevel": -1,
"editor.fontSize": 26,
"editor.tabSize": 1,
"files.autoSave": "off",
"editor.wordWrap": "on",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"highlight-matching-tag.styles": {
"opening": {
"left": {
"custom": {
"borderWidth": "0 0 0 5px",
"borderStyle": "Solid",
"borderColor": "Yellow",
"borderRadius": "5px",
"overviewRulerColor": "white"
}
},
"right": {
"custom": {
"borderWidth": "0 5px 0 0",
"borderStyle": "Solid",
"borderColor": "Yellow",
"borderRadius": "5px",
"overviewRulerColor": "white"
}
}
}
},
"prettier.singleQuote": true
}

Related

how to edit string in editable datatable?

I am using dash_table.DataTable() with cell value of date string. I use editable=True so I can delete and change whole cell's value. I am wondering if I can edit part of string value? For example, below the cell value is a date string of 2021-10-31 18:00. How can I just change month or hour data or whatever without changing whole string? Typically, we just double click the location to highlight the part which need to be changed. But this double-click doesn't work for DataTable. Thanks
from dash_table import DataTable
mytable=DataTable(
id="date-table",
columns=columns,
data=data,
editable=True,
active_cell={"row": 0, "column": 0},
fixed_rows={"headers": True},
sort_action="native",
derived_virtual_data=data,
style_table={
"minHeight": "85vh",
"height": "85vh",
"overflowY": "scroll",
"borderRadius": "0px 0px 10px 10px",
},
style_cell={
"whiteSpace": "normal",
"height": "auto",
"font-family": "verdana",
},
style_header={
"textAlign": "center",
"fontSize": 14,
},
style_data={
"fontSize": 12,
},
style_data_conditional=[
{
"if": {"column_id": 'Well'},
"width": "30%",
"textAlign": "center",
"textDecoration": "underline",
"cursor": "pointer",
},
{
"if": {"column_id": 'Type'},
"width": "50%",
"textAlign": "center",
},
{
"if": {"column_id": 'Pad'},
"width": "20%",
"textAlign": "center",
},
{"if": {"row_index": "odd"}, "backgroundColor": "#fafbfb"},
],
)
It appears this is possible by double clicking THEN moving the arrow keys. Requires hitting enter to save changes. If you lose focus, they're gone.
I'm using dash 2.0.0 and dash-datatable 5.0.0.

How to transcode MP4 video with SRT subtitle on AWS Elemental MediaConvert

I have a MP4 video with SRT captions and I need to transcode them with media convert. In media convert I set automatic ABR and I specified the SRT origin path.
At the moment, I have tested the following:
I set SRT file in one output and video/audio in another
I set SRT, video and audio in the same output
For the first test, the job finish successfully, but on the S3 bucket there isnt any .SRT file. For the second test, the job fails with "aption destination type [SRT] requires a raw muxer." message
This is my JSON for the first test
{
"Queue": "arn:aws:mediaconvert:us-east-1:{{ACCOUNT-NUMBER}}:queues/Default",
"UserMetadata": {},
"Role": "arn:aws:iam::{{ACCOUNT-NUMBER}}:role/{{MY-ROLE-NAME}}",
"Settings": {
"TimecodeConfig": {
"Source": "ZEROBASED"
},
"OutputGroups": [
{
"Name": "DASH ISO",
"Outputs": [
{
"ContainerSettings": {
"Container": "MPD"
},
"VideoDescription": {
"ScalingBehavior": "DEFAULT",
"TimecodeInsertion": "DISABLED",
"AntiAlias": "ENABLED",
"Sharpness": 50,
"CodecSettings": {
"Codec": "H_264",
"H264Settings": {
"InterlaceMode": "PROGRESSIVE",
"ScanTypeConversionMode": "INTERLACED",
"NumberReferenceFrames": 3,
"Syntax": "DEFAULT",
"Softness": 0,
"GopClosedCadence": 1,
"GopSize": 90,
"Slices": 1,
"GopBReference": "DISABLED",
"SlowPal": "DISABLED",
"EntropyEncoding": "CABAC",
"FramerateControl": "INITIALIZE_FROM_SOURCE",
"RateControlMode": "QVBR",
"CodecProfile": "MAIN",
"Telecine": "NONE",
"MinIInterval": 0,
"AdaptiveQuantization": "AUTO",
"CodecLevel": "AUTO",
"FieldEncoding": "PAFF",
"SceneChangeDetect": "ENABLED",
"QualityTuningLevel": "MULTI_PASS_HQ",
"FramerateConversionAlgorithm": "DUPLICATE_DROP",
"UnregisteredSeiTimecode": "DISABLED",
"GopSizeUnits": "FRAMES",
"ParControl": "INITIALIZE_FROM_SOURCE",
"NumberBFramesBetweenReferenceFrames": 2,
"RepeatPps": "DISABLED",
"DynamicSubGop": "STATIC"
}
},
"AfdSignaling": "NONE",
"DropFrameTimecode": "ENABLED",
"RespondToAfd": "NONE",
"ColorMetadata": "INSERT"
},
"AudioDescriptions": [
{
"AudioTypeControl": "FOLLOW_INPUT",
"AudioSourceName": "Audio Selector 1",
"CodecSettings": {
"Codec": "AAC",
"AacSettings": {
"AudioDescriptionBroadcasterMix": "NORMAL",
"Bitrate": 96000,
"RateControlMode": "CBR",
"CodecProfile": "LC",
"CodingMode": "CODING_MODE_2_0",
"RawFormat": "NONE",
"SampleRate": 48000,
"Specification": "MPEG4"
}
},
"StreamName": "latino",
"LanguageCodeControl": "FOLLOW_INPUT",
"LanguageCode": "SPA"
}
]
},
{
"ContainerSettings": {
"Container": "MPD"
},
"CaptionDescriptions": [
{
"CaptionSelectorName": "Captions Selector 1",
"DestinationSettings": {
"DestinationType": "SRT"
},
"LanguageCode": "SPA",
"LanguageDescription": "latino"
}
]
}
],
"OutputGroupSettings": {
"Type": "DASH_ISO_GROUP_SETTINGS",
"DashIsoGroupSettings": {
"SegmentLength": 30,
"MinFinalSegmentLength": 0,
"Destination": "s3://{{BUCKET-NAME}}/streaming15/dash-iso/",
"FragmentLength": 2,
"SegmentControl": "SINGLE_FILE",
"MpdProfile": "ON_DEMAND_PROFILE",
"HbbtvCompliance": "NONE"
}
},
"AutomatedEncodingSettings": {
"AbrSettings": {
"MaxAbrBitrate": 8000000,
"MinAbrBitrate": 600000
}
}
}
],
"AdAvailOffset": 0,
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"Offset": 0,
"DefaultSelection": "DEFAULT",
"ProgramSelection": 1
}
},
"VideoSelector": {
"ColorSpace": "FOLLOW",
"Rotate": "DEGREE_0",
"AlphaBehavior": "DISCARD"
},
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"InputScanType": "AUTO",
"TimecodeSource": "ZEROBASED",
"CaptionSelectors": {
"Captions Selector 1": {
"SourceSettings": {
"SourceType": "SRT",
"FileSourceSettings": {
"SourceFile": "s3://{{BUCKET-NAME}}/PROMO_CAP_01.srt"
}
}
}
},
"FileInput": "s3://{{BUCKET-NAME}}/PROMO_CAP_01.mp4"
}
]
},
"AccelerationSettings": {
"Mode": "DISABLED"
},
"StatusUpdateInterval": "SECONDS_60",
"Priority": 0
}
What I am missing?
According to the AWS Elemental MediaConvert user guide, SRT is not a supported output for a DASH-ISO output group when the input caption type is SRT.
Here's a link to that guide (reference page 176):
https://docs.aws.amazon.com/mediaconvert/latest/ug/mediaconvert-guide.pdf
The supported caption outputs for SRT input in DASH-ISO are:
Burn in
IMSC (as sidecar .fmp4)
IMSC (as sidecar .xml)
TTML (as sidecar .fmp4)
TTML (as sidecar .ttml)
Additionally, there is a gap in the documentation. SRT->DASH-ISO+WebVTT is supported, even though it is not listed. The documentation will be corrected, but I wanted to share that with you in case it helps.
If you must send SRT to the output destination, then you could create a separate output group where the caption is in a track with no container (see pages 192-196 in the document).

Is this a correct json format for what I'm trying to achieve?

For a school project we need to create a home automation network. Our group wants to use the json format to configure nodes to work with each other. We want to link an address of a node to a specific button to certain leds on the node (each node in the network has 2 buttons and 2 leds, a red one and a green one). The json file I made looks as follows:
{
"address": 123412
[
{
"buttonOne": "true"
[
{
"green": "true",
"red": "false"
}
],
"buttonTwo": "false"
[
{
"green": "false",
"red": "false"
}
]
}
]
}
I am new to json so what I want to know is: Is this the correct format for what I'm trying to achieve? Right now I want to be able to read out the address and find out what buttons are bound to what leds. In the example above "buttonOne" should be linked to the green led and "buttonTwo" should be disabled.
if you want to use it for single address. you can create a single JSON object as follows.
{
"address": 123412,
"buttonOne": {
"on": true,
"green": true,
"red": false
},
"buttonTwo": {
"on": false,
"green": false,
"red": false
}
}
Here I am assuming "on" property is used for representing the button ON/OFF state.
if you want to define it for multiple addresses. then you can define an JSON array of objects as follows.
[
{
"address": 123412,
"buttonOne": {
"on": true,
"green": true,
"red": false
},
"buttonTwo": {
"on": false,
"green": false,
"red": false
}
},
{
"address": "nextAddress",
"buttonOne": {
"on": "some_value",
"green": "some_value",
"red": "some_value"
},
"buttonTwo": {
"on": "some_value",
"green": "some_value",
"red": "some_value"
}
}
]

how to change background color of amchart gauge graph in angular 6

I am using gauge graph of amchart having multiple axes with the help of following code from amchart tutorial in my angular6 app.
var chart = AmCharts.makeChart( "chartdiv", {
"theme": "red",
"type": "gauge",
"backgroundColor":"#67b7dc",
"axes": [ {
"axisColor": "#67b7dc",
"axisThickness": 3,
"endValue": 240,
"gridInside": false,
"inside": false,
"radius": "100%",
"valueInterval": 20,
"tickColor": "#67b7dc",
"backgroundColor":"#67b7dc"
}, {
"axisColor": "#fdd400",
"axisThickness": 3,
"endValue": 160,
"radius": "40%",
"valueInterval": 20,
"tickColor": "#fdd400"
} ],
"arrows": [ {
"color": "#67b7dc",
"innerRadius": "20%",
"nailRadius": 0,
"radius": "85%"
} ],
"export": {
"enabled": true
}
} );
The code works fine in my angular app, but I failed to add backgroundcolor to the axes.I found there is an option for chaging the border color of the axes, but how can I add different background colors for the two axes?

how to pass params as json arrays in postman having key and value pair

I am not able to pass json array in postman with key and value pair.
when using like this working
[
{
"serviceTypeId": 40,
"serviceName": "standard Cut2",
"active": true,
},
{
"serviceTypeId": 44,
"serviceName": "Special Cut1",
"active": true,
},
{
"serviceTypeId": 46,
"serviceName": "Feather xxxy",
"active": true,
}
]
but when i add a key its not(i.e like below)
{"serviceType": [
{
"serviceTypeId": 40,
"serviceName": "standard Cut2",
"active": true,
},
{
"serviceTypeId": 44,
"serviceName": "Special Cut1",
"active": true,
},
{
"serviceTypeId": 46,
"serviceName": "Feather xxxy",
"active": true,
}
]
}
Your Json is not correctly formatted, there is an extra comma after active attribute. Remove it. It should be :
[
{
"serviceTypeId":40,
"serviceName":"standard Cut2",
"active":true
},
{
"serviceTypeId":44,
"serviceName":"Special Cut1",
"active":true
},
{
"serviceTypeId":46,
"serviceName":"Feather xxxy",
"active":true
}
]
Try this in array :
{
"serviceType":[
{
"serviceTypeId":40,
"serviceName":"standard Cut2",
"active":true
},
{
"serviceTypeId":44,
"serviceName":"Special Cut1",
"active":true
},
{
"serviceTypeId":46,
"serviceName":"Feather xxxy",
"active":true
}
]
}
When your not sure about your JSON you can use tools on the internet like this : https://jsonformatter.curiousconcept.com/ .
You will be able to see quickly if your json is correct.