Sublime Text 2 double quote font-style depends on file extension? - macos

The auto-pairing of double quotes is a really strange issue that I thought I'd solved but still persists. The issue is that for files of the extension .php, .html, the default font-style of auto-paired double quotes is not parseable. To show you what I mean, notice the font-style of the double quotes in the <div> on the left. Whereas with .js and .css files, the double quote auto-pairing has the proper font-style as shown in the <div> on the right>.
This must be a setting somewhere but I don't know Sublime Text2 (Mac OSX) so well. Thoughts?

With the huge help from #JamieJag I've isolated the problem. Shift+" was producing what Sublime calls "typographical" quotes and not the double quotes which are parseable as part of PHP or HTML code.
To fix the problem, I commented out everything in my SublimeText2 preferences->key bindings->user.
It's unclear to me whether one or all of these JSON object is responsible for the problematic behavior (though I'd guess the first JSON looks like the offender) but so far just commenting out the entire array solved my problem.
/*[
// Auto-pair typographical quotes
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "“$0”"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|”|;|\\}|$)", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "“${0:$SELECTION}”"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
{ "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\”", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
// Smart quotes before & after word
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "“$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\S", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "”$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\S", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
}
]*/

Related

Draw tree Layout chart in vega

I want to have a tree chart of my data using vega in kibana 7.9.0, but I don't know how to write the query for that.
the below code is an example of tree chart from github website. I want such layout for my own index which I have it in kibanan.
Help me how to do that.
tree chart example
Sample tree chart code:
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "An example of Cartesian layouts for a node-link diagram of hierarchical data.",
"width": 1000,
"height": 1600,
"padding": 5,
"signals": [
{
"name": "labels", "value": true,
"bind": {"input": "checkbox"}
},
{
"name": "layout", "value": "tidy",
"bind": {"input": "radio", "options": ["tidy", "cluster"]}
},
{
"name": "links", "value": "diagonal",
"bind": {
"input": "select",
"options": ["line", "curve", "diagonal", "orthogonal"]
}
},
{
"name": "separation", "value": false,
"bind": {"input": "checkbox"}
}
],
"data": [
{
"name": "tree",
"url": "data/flare.json",
"transform": [
{
"type": "stratify",
"key": "id",
"parentKey": "parent"
},
{
"type": "tree",
"method": {"signal": "layout"},
"size": [{"signal": "height"}, {"signal": "width - 100"}],
"separation": {"signal": "separation"},
"as": ["y", "x", "depth", "children"]
}
]
},
{
"name": "links",
"source": "tree",
"transform": [
{ "type": "treelinks" },
{
"type": "linkpath",
"orient": "horizontal",
"shape": {"signal": "links"}
}
]
}
],
"scales": [
{
"name": "color",
"type": "linear",
"range": {"scheme": "magma"},
"domain": {"data": "tree", "field": "depth"},
"zero": true
}
],
"marks": [
{
"type": "path",
"from": {"data": "links"},
"encode": {
"update": {
"path": {"field": "path"},
"stroke": {"value": "#ccc"}
}
}
},
{
"type": "symbol",
"from": {"data": "tree"},
"encode": {
"enter": {
"size": {"value": 100},
"stroke": {"value": "#fff"}
},
"update": {
"x": {"field": "x"},
"y": {"field": "y"},
"fill": {"scale": "color", "field": "depth"}
}
}
},
{
"type": "text",
"from": {"data": "tree"},
"encode": {
"enter": {
"text": {"field": "name"},
"fontSize": {"value": 9},
"baseline": {"value": "middle"}
},
"update": {
"x": {"field": "x"},
"y": {"field": "y"},
"dx": {"signal": "datum.children ? -7 : 7"},
"align": {"signal": "datum.children ? 'right' : 'left'"},
"opacity": {"signal": "labels ? 1 : 0"}
}
}
}
]
}
I recommend going and learning the Kibana Vega interaction, Vega spec and elasticsearch search api. This is too broad of a question, you are basically asking someone to do the work for you which is easily deducible from the the documentation.
https://www.elastic.co/guide/en/kibana/current/vega.html
https://vega.github.io/vega/docs/
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html

Curly brackets VS Code on mac Osx

Just moved to Mac OSX and I can't type curly brackets with the old ALT-123 for open brace and so on.
Any fast solution?
Thanks!
I didn't figure out but I create some snippets into the keybindings.json
// Empty
[
// INSERT CURLY BRACKETS
{
"key": "alt+numpad2",
"command": "extension.embraceCurlyBrackets",
"when": "editorHasSelection && editorTextFocus"
},
{
"key": "alt+shift+numpad2",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "{\n\t$1\n}",
},
"when": "editorTextFocus"
},
{
"key": "alt+numpad1",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "{$1"
},
"when": "editorTextFocus"
},
{
"key": "alt+numpad3",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "}$1"
},
"when": "editorTextFocus"
},
// INSERT CONSOLE LOG
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"args": {
"snippet": "console.log($1)"
},
"when": "editorTextFocus"
},
]
A few shortcuts to speed up the work!

Get out of brackets and parenthesis with Tab

The problem is you have to use arrows or Macros to jump out of parenthesis, square brackets, curly brackets, single quotes and double-quotes.
The easy solution I found to this problem :
[VSCode] there's an extension called TabOut, install it (done).
[SublimeText3] we have to make some changes to Key Bindings
Preferences>Key Bindings
copy and paste the snippet below to the right side pane, save and close this window.
(tested and working ✌)
[
{ "keys": ["("], "command": "insert_snippet", "args": {"contents": "($1)$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true }
]
},
{ "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$1}$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true }
]
},
{ "keys": ["["], "command": "insert_snippet", "args": {"contents": "[$1]$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true }
]
},
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$1\"$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }
]
},
{ "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$1'$0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }
]
},
]

filter jqgrid with multiple "and" and "or" conditions

I want to filter jQGrid using below search criteria
Name="Mark" and Age=25 and (city="NY" or city="FL") and (company="xyz" or company="zyx")
below is my search string
{
"groupOp": "AND",
"rules": [{
"field": "Name",
"op": "eq",
"data": "Mark"
}, {
"field": "Age",
"op": "eq",
"data": "25"
}],
"groups": [{
"groupOp": "OR",
"rules": [{
"field": "city",
"op": "eq",
"data": "NY"
},
{
"field": "city",
"op": "eq",
"data": "FL"
}
],
"groups": [{
"groupOp": "OR",
"rules": [{
"field": "company",
"op": "eq",
"data": "xyz"
},
{
"field": "company",
"op": "eq",
"data": "zyx"
}
]
}]
}]
}
and
postData: {
filters: above string
},
but this search is not working. please help
It seems that you have an error in the last "groups" part. The correct filter should looks like
{
"groupOp": "AND",
"rules": [
{ "field": "Name", "op": "eq", "data": "Mark" },
{ "field": "Age", "op": "eq", "data": "25" }
],
"groups": [
{
"groupOp": "OR",
"rules": [
{ "field": "city", "op": "eq", "data": "NY" },
{ "field": "city", "op": "eq", "data": "FL" }
],
"groups": []
},
{
"groupOp": "OR",
"rules": [
{ "field": "company", "op": "eq", "data": "xyz" },
{ "field": "company", "op": "eq", "data": "zyx" }
],
"groups": []
}
]
}
Additionally, I'd strictly recommend you to include the version of jqGrid, which you use (can use) and the fork (free jqGrid, commercial Guriddo jqGrid JS or an old jqGrid in version <=4.7).
If you really use "free jqGrid" (not an old jqGrid in version <=4.7), then you can use "IN" operator with local dataset. The value should be comma-separated list of values and the
{
"groupOp": "AND",
"rules": [
{ "field": "Name", "op": "eq", "data": "Mark" },
{ "field": "Age", "op": "eq", "data": "25" },
{ "field": "city", "op": "eq", "data": "NY,FL" },
{ "field": "company", "op": "eq", "data": "xyz,zyx" }
]
}
Additionally free jqGrid allows to replace the default comma separator (which could be included in some company names) to any alternative symbol defined by jqGrid option inFilterSeparator.

Query with terms does not work properly

I have this document in Elasticsearch (1.6)
{
"_index": "onkopedia",
"_type": "document_",
"_id": "0afa26afc2d1440a8ed03dac0e8511fc",
"_version": 1,
"_score": null,
"_source": {
"description": "",
"contributors": [ ],
"metaTypeName": "Connector",
"sortableTitle": "mammakarzinom der frau",
"subject": [ ],
"authorizedUsers": [
"Anonymous"
],
"language": "",
"title": "Mammakarzinom der Frau",
"url": "http://dev1.veit-schiele.de:9080/onkopedia/de/onkopedia/guidelines/mammakarzinom-der-frau",
"author": "ajung",
"modified": "2015-05-11T05:21:14",
"metaType": "xmldirector.plonecore.connector",
"content": " Mammakarzinom der Frau Stand: Januar 2013 Autoren der aktuellen .....",
"authorName": "ajung",
"created": "2015-05-11T05:21:14",
"review_state": "published"
},
"sort": [
null
]
}
containing a key
'authorizedUsers': ['Anonymous']
The following query is supposed to return the document above however it does not:
{
"sort": [
"_score"
],
"from": 0,
"fields": [
"url",
"title",
"description",
"metaType",
"metaTypeName",
"author",
"authorName",
"contributors",
"modified",
"subject",
"review_state",
"language",
"content"
],
"query": {
"filtered": {
"filter": {
"and": [
{
"terms": {
"execution": "or",
"metaType": [
"Document",
"FormFolder",
"Collection",
"Discussion Item",
"News Item",
"xmldirector.plonecore.connector",
"CaptchaField"
]
}
},
{
"terms": {
"execution": "or",
"authorizedUsers": [
"Manager",
"Authenticated",
"Anonymous",
"user:ajung"
]
}
}
]
},
"query": {
"query_string": {
"query": "mammakarzinom",
"default_operator": "AND",
"fields": [
"title^3",
"contributors^2",
"subject^2",
"description",
"content"
]
}
}
}
},
"highlight": {
"fields": {
"content": {
"fragment_size": 250,
"number_of_fragments": 3
},
"description": {
"fragment_size": 250,
"number_of_fragments": 2
},
"title": {
"number_of_fragments": 0
}
}
},
"size": 15
}
The query without the filter for 'authorizedUsers' does return the document.
Why? 'Anonymous' as value for 'authorizedUsers' is available within the query, so I would expect that the document would be found by the first query, or?
{
"sort": [
"_score"
],
"from": 0,
"fields": [
"url",
"title",
"description",
"metaType",
"metaTypeName",
"author",
"authorName",
"contributors",
"modified",
"subject",
"review_state",
"language",
"content"
],
"query": {
"filtered": {
"filter": {
"and": [
{
"terms": {
"execution": "or",
"metaType": [
"Document",
"FormFolder",
"Collection",
"Discussion Item",
"News Item",
"xmldirector.plonecore.connector",
"CaptchaField"
]
}
}
]
},
"query": {
"query_string": {
"query": "mammakarzinom",
"default_operator": "AND",
"fields": [
"title^3",
"contributors^2",
"subject^2",
"description",
"content"
]
}
}
}
},
"highlight": {
"fields": {
"content": {
"fragment_size": 250,
"number_of_fragments": 3
},
"description": {
"fragment_size": 250,
"number_of_fragments": 2
},
"title": {
"number_of_fragments": 0
}
}
},
"size": 15
}
Probably your analyzer for authorizedUsers field is lowercasing the value itself. So, in your index the actual values is anonymous (lowercase a).
Try this filter:
{
"terms": {
"execution": "or",
"authorizedUsers": [
"manager",
"authenticated",
"anonymous",
"user:ajung"
]
}
}
meaning, search the index with the values that are actually there.
One more thing: terms is not analyzing the input text. This means that if you search for Anonymous then this is what it will look into the index. Since you have anonymous in the index, it will not match.

Resources