Helm multi-selection pre select multiple candidates - emacs

I have a helm source:
(setq helm-source
`((name . "My source")
(candidates . ("Option 1" "Option 2" "Option 3" "Option 4"))
(action . (lambda (candidate) (helm-marked-candidates)))))
And later get the selected options like this:
(setq result (helm :sources '(helm-source)))
I want that "Option 2" and "Option 3" are already marked in the same way I could mark them with C-SPC.

Related

How to select multiple values from VS Code choice-type snippet?

I use VS Code and Markdown to journal and track things. The following markdown snippet is an example of using choice-type variables in a snippet.
How would I select multiple TOOLS from the choice below?
As soon as I choose 1 option, I'm taken to $0.
"Context": {
"prefix": "scontext",
"body": [
"- **TYPE:** ${1|COMMS,SUPPORT,RESEARCH,MEETING,DEVELOPMENT,TESTING,VALIDATION,PROJECT MGMT,CONSULTING,DOCUMENTATION,ADMINISTRATION,TRAINING,BREAK|}",
"- **PROJECT:** ${2|Project1,Project2,Project3|}",
"- **TOOLS:** ${3|Python,Azure Storage,Azure Function,Azure Key Vault,Etc.|}",
"- **START:** ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}-08:00",
"- **END:** ",
"- **DURATION:** ",
"- **NOTES:**",
" - $0",
"---"
],
"description": "New context"
},

How to add dollar signs in Code Snippets of Visual Studio Code?

$ (dollar signs) are removed from Snippets in Visual Studio Code
How to disable placeholders?
My vue-html.json file snippet
"body": ["<ActivityIndicator v-if=\"$apollo.loading\" />"]
does not add $ and produces
<ActivityIndicator v-if="apollo.loading" />
but instead it should produce
<ActivityIndicator v-if="$apollo.loading" />
"description": {
"prefix": "trigger",
"body": [
"<ActivityIndicator v-if=\"\\$apollo.loading\" />"
],
"description": "description"
}
In JSON the backslash itself needs to be encoded with \, which is why you need \\
"body": ["<ActivityIndicator v-if=\"\\$apollo.loading\" />"]
You need to escape the $ symbol individually too

Ag-grid clojurescript sortable key doesn't work

I am trying to make a grid with ag-grid and activate sortable and filter, but it doesn't work towards localhost. In the columndefinition, I use
''':sortable true'''
''':filter true''''
But nothing happens. Does anyone know what is wrong?
(ns reagent-ag-grid-ex.core
(:require
[reagent.core :as r]
[cljsjs.ag-grid-react]
[reagent-ag-grid-ex.state :as state]))
;; -------------------------
;; Views
(def ag-adapter (r/adapt-react-class (.-AgGridReact js/agGridReact) ))
;;(defn get-cols [entry]
;; (into [] (map #(hash-map :headerName (-> % key name) :field (-> % key name)) entry)))
;;columnDefs: [ {headerName: "Make", field: "make"}, {headerName: "Model", field: "model"}, {headerName: "Price", field: "price"} ]
;;rowData: [ {make: "Toyota", model: "Celica", price: 35000}, {make: "Ford", model: "Mondeo", price: 32000}, {make: "Porsche", model: "Boxter", price: 72000}]
(def deafult-col-w 200)
(defn width-helper [lst]
(+ (* deafult-col-w (count lst)) 2))
(defn home-page []
[:div [:h2 "Ekspono tag-model"]
[:p "My portfolio / Top Index " [:a {:style {:background-color "#C0C0C0" :float "right" :color "black"}
:href "https://www.google.com" :target "_blank"} "Show problems"]]
[:div {:className "ag-theme-balham" :style {:height 200 :width (width-helper state/cols) :color "purple"}}
[ag-adapter {"columnDefs" state/cols
"rowData" state/rows
"defaultColDef" {:sortable true
:width deafult-col-w}}]]
[:div [:a {:href "https://www.tabyenskilda.se/fredrik-cumlin/" :target "_blank"}
"#copyright Fredrik Cumlin"]]])
;; -------------------------
;; Initialize app
(defn mount-root []
(r/render [home-page] (.getElementById js/document "app")))
(defn init! []
(mount-root))
Upgrade to latest ag-grid-react cljsjs distribution (21.0.1-1) - e.g. using lein project.clj switch dep to [cljsjs/ag-grid-react "21.0.1-1"]. Should work on this version.
Also as a side note, no need to specify prop keys with strings, you can use keywords - it's a bit more idiomatic.

How to escape $ in Visual Studio Code snippet creation

It seems when using PHP variables like $_SERVER the code snippet ignores the $. For example
{
// Example:
"IP Address Test": {
"scope": "php",
"prefix": "iptest",
"body": [
"// Debugging",
"if($_SERVER[\"REMOTE_ADDR\"]=='${1:ipaddress}'){",
"\t//run only my ip",
"\t$0",
"}"
],
"description": "Test only from IP address"
}
}
outputs :
// Debugging
if(_SERVER["REMOTE_ADDR"]=='xxx.xxx.xxx.xxx'){
//run only my ip
}
You can't use \ you have to use double $ ..
eg.
// Debugging
if($$_SERVER["REMOTE_ADDR"]=='xxx.xxx.xxx.xxx'){
//run only my ip
}

Uploading a CSV file, distorted characters

I am having a problem when uploading a csv file through the following query,
COPY adwords_initial("Account",
"Week",
"Campaign",
"Keyword",
"Ad group",
"Keyword state",
"Match type",
"Max. CPC",
"Clicks",
"Impressions",
"Cost",
"Avg. position",
"Ad group state",
"Campaign state",
"Status",
"Qual. score (hist.)",
"Expected clickthrough rate (hist.)",
"Ad relevance (hist.)",
"Landing page experience (hist.)",
"First page CPC",
"First position CPC",
"Top of page CPC",
"Bounce rate","Pages / session",
"Avg. session duration (seconds)",
"% new sessions",
"Search Exact match IS",
"Search Lost IS (rank)",
"Search Impr. share",
"Conversions",
"Conv. rate")
FROM 'C:\Users\iantu\Desktop\Performance Marketing\Report inputs\input.csv'
DELIMITER ',' CSV HEADER encoding 'windows-1251';
Characters in French do not translate accordingly as an example
in keyword the original file has +connectivité +IoT
in keyword the postgresql file has +connectivitй +IoT
Do settings have to be changed within my application?
I should also mention that I then export this using the following query, however, the data as can be seen is already corrupted within the database.
COPY (SELECT * FROM adwords_initial) TO 'C:\Users\iantu\Desktop\Performance Marketing\Report Outputs\in between workflow.csv' WITH CSV HEADER;
Use latin1 as encoding:
COPY adwords_initial("Account",
"Week",
"Campaign",
"Keyword",
"Ad group",
"Keyword state",
"Match type",
"Max. CPC",
"Clicks",
"Impressions",
"Cost",
"Avg. position",
"Ad group state",
"Campaign state",
"Status",
"Qual. score (hist.)",
"Expected clickthrough rate (hist.)",
"Ad relevance (hist.)",
"Landing page experience (hist.)",
"First page CPC",
"First position CPC",
"Top of page CPC",
"Bounce rate","Pages / session",
"Avg. session duration (seconds)",
"% new sessions",
"Search Exact match IS",
"Search Lost IS (rank)",
"Search Impr. share",
"Conversions",
"Conv. rate")
FROM 'C:\Users\iantu\Desktop\Performance Marketing\Report inputs\input.csv'
DELIMITER ',' CSV HEADER encoding 'latin1';