Vscode settings problems - css

So I'm editing my settings in JSON and it all works well but this error keeps popping up:
"Expected comma jsonc(514)"
This is my code:
"css.lint.emptyRules": "ignore",
This is the whole json file just in case:
Whole Json file

You are missing a comma after the "gitlens.advanced.messages" object and before "css.lint.emptyRules": "ignore". That should solve your issue, also I highly advise you to take a look here JSON Syntax

Related

settings.json: parse error reading settings file

This is my json in the settings.json file:
{ "public": { "Name": "yashwanth" }, "private": { "oAuth": {
"linkedin": { "clientId": "", "secret": "" } } } }
And when I run my app
meteor --settings settings.json
the console says
While preparing to run: settings.json: parse error reading settings
file
I know its an old post but I am answering it just in case anyone encounters this issue. It turns out that it all boils down to the encoding of the file. If the file contains some invalid characters (as in not properly encoded) then meteor complains and you won't be able to parse the file successfully. A really simple workaround to this problem is to copy and paste the 'package.json' located in the root folder to the same folder and rename it to 'settings.json'. You can then edit this file manually by typing in the desired contents. Another thing you should always avoid is to use single quotes. You should avoid using single quotes for name/value pairs and you should always use double ones. A good website for json validation is JSONLint as it will identify any syntax errors you might have. Finally, it is worth noting that Notepad++ should not have any issues saving the file in the desired format. Make sure you use UTF-8 for the encoding.
Hope this helps anyone reading this and having the same problem.
Cheers
Parse error occurs if you have an invalid json string in your settings.json.
The content of your settings.json seems to be valid however, it is possible that
your file contains hidden chars (like UTF byte order mark) possibly because of copy / paste.
Remove the file and recreate it with an editor so that you are sure json has no hidden chars.
After investigating thoroughly, I found out the encoding of the json is the one causing issues. It was saved in UTF-8-BOM, changing it to UTF-8 solved the issues.

Running Go from the command line nested JSON

I can think of workarounds on how to get this working however I'm interested in finding out if there's a solution to this specific problem.
I've got a go program which requires a json string arguement:
go run main.go "{ \"field\" : \"value\" }"
No problems so far. However, am I able to run from the command line if one of the json values is another json string?
go run main.go "{ \"json-string\" : \"{\"nestedfield\" : \"nestedvalue\"}\" }"
It would seem that adding escape characters incorrectly matches up the opening and closing quotes. Am I minuderstanding how this is done or is it (and this is the side I'm coming down on) simply not possible?
To reiterate, this is a question that has piqued my curiosity - I'm aware of alternative approaches - I'm hoping for input related to this specific problem.
Why don't you just put your json config to the file and provide config file name to your application using flag package
Based on the feedback from wiredeye I went down the argument route instead. I've modified the program to run on:
go run main.go field:value field2:value json-string:"{\"nestedfield\":nestedvalue}"
I can then iterate over the os.Args and get the nested json within my program. I'm not using flags directly as I don't know the amount of inputs into the program which would have required me to use duplicate flags (not supported) or parse the flag to a collection (doesn't seem to be supported).
Thanks wiredeye

Flex- handle error thrown by decodeURIComponent component for some utf-8 encoded strings

How to I handle the erros thrown by the decodeURIComponent. By handling I mean that when the decodeURIComponent throws some error I want that the characters which caused the issue to be stripped out or replaced by some default charcters.
In my case i have an encoded string which contains the 'emojis' url encoded like this '%20%f0%9f%98%8f'. So when i try to decode it using decodericomponent it creates an error may be beacuse doesn't support unicoded character.
One way i thought of handling this is
If the decodeuricomponent throws an error then create a custom function that would first replace all emojis utf-8 represtations (http://apps.timwhitlock.info/emoji/tables/unicode) with some default characters and then deocde it.
Say for eg: replace occurence of '%F0%9F%98%8A' with ':)' and so on.
But what if there are still some cases left out. Then it would again throw an error.
Can anybody help out.
Thanks in advance.

highcharts prepare options for POST

I need to send a Highcharts options object to an asp page so it can be written to a json flat file. These files are later passed to phantomjs via highcharts-convert in order to create some pdfs.
The problem however is stringifying the objects. I keep getting this error:
Uncaught TypeError: Converting circular structure to JSON
when I try this:
$.post("myASP.asp", JSON.stringify(myChart.highcharts().options));
There is a sample POST string here http://docs.highcharts.com/#render-charts-on-the-server but I'm not sure how to achieve that with mine. When I paste their sample into my code for testing I get all kinds of unescaped double quote errors. Is that a typo on their part?
I would check if there are curricular references in the JSON objects. As far as I remember that is not supported by the JSON serializer.
One example of this if you have an object with an array of children that refer back to the parent.
I think you can try the following:
{"infile":myChart.getSVG()}
This should get the svg representation of the chart

"Could not reformat the document" in ASP.NET, VS2008

I'm in an ASP.NET UserControl. When I type Control-K, Control-D to reformat all the markup, I get a series of messages from VS 2008:
"Could not reformat the document. The original format was restored."
"Could not complete the action."
"The operation could not be completed. The parameter is incorrect."
Anybody know what causes this?
Edit: OK, that is just...weird.
The problem is here:
<asp:TableCell>
<asp:Button Text="Cancel" runat="server" ID="lnkCancel" CssClass="CellSingleItem" />
</asp:TableCell>
Somehow that asp:Button line is causing the problem. But if I delete any individual attribute, the formatting works. Or if I add a new attribute, the formatting works. Or if I change the tag to be non-self-closing, it works. But if I undo and leave it as-is, it doesn't work.
All I can figure is that this is some sort of really obscure, bizarre bug.
There's probably some malformed markup somewhere in your document. Have you tried it on a fresh document?
Did get the problem today.
My solution: Restart Visual Studio
Usually this sort of behavior is caused by invalid code. It may only be invalid HTML causing it which would still allow the program to be compiled.
For example, if tags are mismatched like this the IDE cannot reformat it.
<div><h1>My Title</div></h1
Check your warnings to see if there are any entries pointing towards mismatched or unclosed tags.
For me, it's usually as issue with whitespace. To fix it, I open Find and Replace (CTRL+H), set Look in to "Current Document", check Use and select "Regular expressions". For Find what I enter ":b|\n" (minus quotes), and for Replace with I enter a single space. Then I click Replace All.
The steps above will replace all whitespace—including line breaks—with a single space, and the next time you format the document, you shouldn't get any errors. That is assuming you don't have malformed HTML.
select the entire suspicious codes segments and use Ctrl+k,Ctrl+F to format only the selected segments instead of whole document .
this way you can find the exact place of problems specially not closed or inappropriate closed tags and fix them .
after all scanning segment by segment is done you can format the whole document for sure
My problem was an extra ". Look carefully the html.
I encountered this for the first time a few weeks ago. I found it was down to invalid HTML. I had to cut out sections of content and paste it back in a little at a time to track down the problem.
For me, I had some bogus characters in my markup code. I only found this out by copy and pasting all my text into Notepad. After that, I saw the bogus characters (showed up as little squares). I just deleted those lines and retyped them and now everything is ok.
I had an unwanted semi-colon. But you may have quote ('), double quote ("), semi-colon (;) or any special character.
So, editing my answer with more details and a screenshot because it still very active.
Go to that line by double clicking the error and search for the extra (unwanted) quote ('), double quote ("), semi-colon (;) or any special character. Remove it because it is causing the error.
Just to add some more information. This issue is caused due to some invalid markup in html.
It won't cause any blocking while running the application.
Unfortunately the solutions mentioned here did not work for me.
1. Restarting visual studio
2. Replacing spaces using regex etc
The best solution to fix the issue is to go to the specific line where the issue is caused and check that line for any invalid symbols like , or ". Just remove it and it will work fine.
My issue is extra " in the value of html attribute, After removing this it is working fine for me.

Resources