Here is the exact error I get as I open the program:
Error trying to parse settings: Expected value in ~/Library/Application Support/Sublime Text 2/Packages/Default/Preferences.sublime-settings:1:13677
You can remove the comments and use a service like http://zaach.github.io/jsonlint/ to validate the JSON.
Packages/Default/Preferences.sublime-settings. Check that file instead (Sublime Text 2 -> Preferences -> Settings - Default
{
"bold_folder_labels": true,
"caret_style": "phase",
"fade_fold_buttons": false,
"font_face": "Consolas",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": 1,
"line_padding_top": 1
}
Related
I am using apache-superset 2.0.0 and python 3.9. I have created the superset_config.py file as shown below, exported the SUPERSET_CONFIG_PATH and after initializing superset I get the following message "Loaded your LOCAL configuration at [/home/...]". However, the enabled features are still not shown when creating/editing charts. Can anybody help me out?
# Superset specific config
ROW_LIMIT = 5000
# ---------------------------------------------------
# Feature flags
# ---------------------------------------------------
# Feature flags that are set by default go here. Their values can be
# overwritten by those specified under FEATURE_FLAGS in superset_config.py
# For example, DEFAULT_FEATURE_FLAGS = { 'FOO': True, 'BAR': False } here
# and FEATURE_FLAGS = { 'BAR': True, 'BAZ': True } in superset_config.py
# will result in combined feature flags of { 'FOO': True, 'BAR': True, 'BAZ': True }
FEATURE_FLAGS = {
"DRILL_TO_DETAIL": True,
"DASHBOARD_CROSS_FILTERS": True,
"ALERTS_ATTACH_REPORTS": True,
"DASHBOARD_NATIVE_FILTERS_SET": True,
"ALERT_REPORTS": True,
"DASHBOARD_FILTERS_EXPERIMENTAL": True,
"ALLOW_ADHOC_SUBQUERY": True,
"DRUID_JOINS": True
}
Thanks in advance
UPDATED CODE: It is working but now the problem is that the code is attaching same random_value to every Path.
Following is my code with a sample chunk of text. I want to read Path and it's value then add (/some unique random alphabet and number combination) at the end of every Path value without changing the already existed value. For example I want the Path to be like
"Path" : "already existed value/1A" e.t.c something like that.
I am unable to make the exact regex pattern of replacing it.
Any help would be appreciated.
It can be done by json parse but the requirement of the task is to do it via REGEX.
from io import StringIO
import re
import string
import random
reader = StringIO("""{
"Bounds": [
{
"HasClip": true,
"Lang": "no",
"Page": 0,
"Path": "//Document/Sect[2]/Aside/P",
"Text": "Potsdam, den 9. Juni 2021 ",
"TextSize": 12.0
}
],
},
{
"Bounds": [
{
"HasClip": true,
"Lang": "de",
"Page": 0,
"Path": "//Document/Sect[3]/P[4]",
"Text": "this is some text ",
"TextSize": 9.0,
}
],
}""")
def id_generator(size=3, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
text = reader.read()
random_value = id_generator()
pattern = r'"Path": "(.*?)"'
replacement = '"Path": "\\1/'+random_value+'"'
text = re.sub(pattern, replacement, text)
#This is working but it is only attaching one same random_value on every Path
print(text)
Use group 1 in the replacement:
replacement = '"Path": "\\1/1A"'
See live demo.
The replacement regex \1 puts back what was captured in group 1 of the match via (.*?).
Since you already have a json structure, maybe it would help to use the json module to parse it.
import json
myDict = json.loads("your json string / variable here")
# now myDict is a dictionary that you can use to loop/read/edit/modify and you can then export myDict as json.
I know there are at least 2 other questions like this on SO but none of those answers are working for me.
I'm trying to customize my user settings on Sublime Text 2 (mac) but when I go to save it I get the error listed below.
Here are my settings.
{
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"default_encoding": "UTF-8 with BOM",
"font_size": 15,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages": [
"Vintage"
],
"line_padding_bottom": 4,
"line_padding_top": 0,
"wide_caret": true
}
Here's the error:
Error trying to parse settings: Expected value in ~/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings:1:1
The answers listed on Sublime Text 2: Error trying to parse settings and on Error trying to parse settings do not help at all.
I installed Markdown Preview in Sublime Text 2, and already set
"enable_highlight": true,
"enable_pygments": true,
I also set the following code in the file codehilite.py:
def __init__(self, *args, **kwargs):
# define default configs
self.config = {
'linenums': [True, "Use lines numbers. True=yes, False=no, None=auto"],
'force_linenos' : [Force, "Depreciated! Use 'linenums' instead. Force line numbers - Default: False"],
'guess_lang' : [True, "Automatic language detection - Default: True"],
'css_class' : ["codehilite",
"Set class name for wrapper <div> - Default: codehilite"],
'pygments_style' : ['default', 'Pygments HTML Formatter Style (Colorscheme) - Default: default'],
'noclasses': [True, 'Use inline styles instead of CSS classes - Default false']
}
super(CodeHiliteExtension, self).__init__(*args, **kwargs)
However, I still cannot see the line numbers in the rendered view. What extra settings are needed?
I am using Sublime Text 3 and have just installed sublime-markdown-preview and was also looking for a way to get nice coloring and linenumbers in the code-block.
The instructions https://github.com/revolunet/sublimetext-markdown-preview
describe to put the line codehilite(linenums=True) into your settings. So I use:
{
"github_mode": "gfm",
"parser": "github",
"build_action": "browser",
"enabled_extensions": [
"extra", "github",
"codehilite(guess_lang=False, pygments_style=github, linenums=True)" ]
}
in my user settings and it works.
Sublime text 2 (Windows 7) has such feature: several lines with carets (no selections made,only carets) are copied to Clipboard separated with empty lines. Can i disable these empty line separators, to copy w/o them?
detail:
open few lines text file
place 3-4 carets using Ctrl+Click on few lines
press Ctrl+C to copy to clibboard
paste into new file-- u see empty line separators for copied text
Think you need a plugin to do it. I didn't test this, but it should work. It's pretty straight forward.
import sublime
import sublime_plugin
class EmptyLineCopyCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
lines = []
for cursor in view.sel():
lines.append(view.substr(view.line(cursor)))
sublime.set_clipboard("\n".join(lines))
Put the following in your user key bindings.
{"keys": ["ctrl+c"], "command": "empty_line_copy", "context": [
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
]},