This question already has answers here:
How to use LOAD_FILE to load a file into a MySQL blob?
(6 answers)
Closed 4 years ago.
INSERT INTO items (id,name,image,price) VALUES('1','iphone 5s',LOAD_FILE('C:\xampp\htdocs\project\1.jpg'),300);
this statement cause error
INSERT INTO items (id,name,image,price) VALUES('1','iphone 5s',LOAD_FILE('C:\xampp\htdocs\project\1.jpg'),300)
MySQL said: Documentation
here is the error
#1048 - Column 'image' cannot be null
Please double check the file path of your "1.jpg" or maybe look at the image format whether it is .jpg or .png.
Else, try this format:
LOAD_FILE('../1.jpg')
"Different backslash position"
I do not think you should mention the C:/xampp/htdocs/project because you are already in the project folder when you run your code.
Hopefully it is working.
You must escape backslashes in any string:
... LOAD_FILE('C:\\xampp\\htdocs\\project\\1.jpg') ...
Or, since MySQL will 'correctly' interpret forward-slashes, even on Windows:
... LOAD_FILE('C:/xampp/htdocs/project/1.jpg') ...
(I assume image is declared BLOB or MEDIUMBLOB?)
Related
This question already has answers here:
Escaping backslash (\) in string or paths in R
(4 answers)
Closed 1 year ago.
In how to change working directory more easily?
Currently, if we use 'setwd',we have to add many '\', sometimes it's boring
Is there any easier way for this ? (Just like Python can add 'r' )
setwd('C:\Users\Administrator\Desktop\myfolder') # can't work
setwd('C:\\Users\\Administrator\\Desktop\\myfolder') # can work,but havt to add many '\'
You could use r (for raw string) and add parenthesis:
> r"(C:\Users\Administrator\Desktop\myfolder)"
[1] "C:\\Users\\Administrator\\Desktop\\myfolder"
>
And now:
setwd(r"(C:\Users\Administrator\Desktop\myfolder)")
Or reading from clipboard automatically adds the extra slashes:
setwd(readClipboard())
This question already has answers here:
How to escape backslashes in R string
(3 answers)
Efficiently convert backslash to forward slash in R
(11 answers)
Closed 3 years ago.
I often want to read in csv files and I get the path by using shift + right click and then clicking "copy path".
I paste this path into my code. See an example below:
read_csv("C:\Users\me\data\file.csv")
Obviously this doesn't work because of the backslashes. My current solution is to escape each one, so that my code looks like this:
read_csv("C:\\Users\\me\\data\\file.csv")
It works, but it's annoying and occasionally I'll get errors because I missed one of the backslashes.
I wanted to create a function automatically adds the extra slashes
fix_path <- function(string) str_replace(string, "\\\\", "\\\\\\\\")
but R won't recognize the string in the first place until the backslashes are taken care of.
Is there another way to deal with this? Python has the option of adding an "r" before strings to note that the backslashes should be treated just as regular backslashes, is there anything similar in R? To be clear, I know that I can escape the backslashes, but I am looking for a way to do it automatically.
You can use this hack. Suppose you had copied your path as mentioned then you could use
scan("clipboard", "character", quiet = TRUE)
scan reads the text copied from the clipboard and takes care about the backslashes. Then copy again what is returned from scan
This question already has answers here:
How to exclude file extensions and languages from "format on save" in VSCode?
(8 answers)
Closed 4 years ago.
Using Visual Studio Code, is it possible to disable the formatting of a specific file (or extension)?
I try to use some Handlebars templates and I don't want VSCode to format them, at all. A simple example would be :
{{test1}}
{{test2}}
When I save this file (I do have - and want - "editor.formatOnSave" set to true), VsCode transforms the content to
{{test1}} {{test2}}
The only way I found for the file to stay untouched, is to name it "template.txt" instead of "template.hbs".
Any idea?
You can add file-specific exclusions like so:
"[handlebars]": { "editor.formatOnSave": false },
executing bootstrap validation
Invalid input:
inputs.yaml. inputs must represent a dictionary.
Valid values can either be a path to a YAML file, a string formatted as YAML or a string formatted as key1=value1;key2=value2
How to solve this problem??
Since there are a lot of missing details in your question, I'll try to explain what could be the answer:
You didn't give the right path to the input.yaml file.
The path could be relative to your working directory, or a full path, but either way it must lead to the file.
Your input file is not formatted correctly.
An input.yaml file should include a dictionary of keys and values as in: image: 'redhat_santiago'. Tabs are not allowed, only spaces. All keys should be aligned to the same column.
Please try to check the above, in the future it would be better if you add the input file and the command you are using.
Best,
Jonathan
This question already has answers here:
Vim: underscore(_) automatically converted to (<-)
(4 answers)
Closed 8 years ago.
By default, the Vim-R-plugin inserts <- whenever I type or paste an underscore _. This creates problems when I paste stuff like geom_bar, which becomes geom <- bar. Is there a way to turn this short-cut off?
I tried looking at the manual (scroll down to Edit section) but couldn't figure out how to do it.
I'm using Vim-R-plugin Version 0.9.9.9
for Vim version 7.4.
From the help page of the plugin:
6.3. Assignment operator and Rnoweb completion of code block
...
To completely disable this feature, put in your vimrc:
let vimrplugin_assign = 0
--
EDIT: As of writing this (2019-10-25), add this to your vimrc instead:
6.4. Assignment operator and Rnoweb completion of code block
...
let R_assign = 0