sqlite exe : database file path has hyphen : "unknown option: -" - sqlite

I am new to SQLITE. I am trying to open a database through Sqlite3.exe shell. My database file path has hyphen in it..
on entering
.open C:\Users\Admin\OneDrive - batch\db.sqlite3
i am getting below error
unknown option: -
can anyone help..
I tried double quote around path but in that case I am getting
Error: unable to open database
Thanks in advance..

Have you tried providing path like that:
C:\Users\Admin\"OneDrive - batch"\db.sqlite3

changing
backward slashes to forward
adding double quotes
worked...
below is the solution
.open "C:/Users/Admin/OneDrive - batch/db.sqlite3"

Related

How to save file into a path containing special characters such as '&'? ('&' which is different from '&' typed in English Keyboard)

I need to write out a file to a certain path that contains a special character in R. the path is something like this: C:/Users/Technology & Innovation/Webscraping files/US_data/data
It works totally fine when I access this path through python, but I cannot access the same path in R. And I cannot change this path name or remove '&' as this path is used by a lot of people. Does anyone have a good idea on how to solve it?
I found out it is '&' which has subtle difference from '&' that we usually type in through English Keyboard. May be that's the reason causing the problem?
Here is what I have tried:
write.csv(df, 'C:/Users/Technology & Innovation/Webscraping files/US_data/data/file.csv').
write.csv(df, 'C:\\Users\\Technology & Innovation\\Webscraping files\\US_data/data/file.csv')
Not matter whether I try to read or write a file, it is not working in my case.
I also tried reset the working directory path and got the error message:
Error in setwd("C:/Users/Technology & Innovation/Webscraping files/US_data/data") : cannot change working directory
Write it like this
C:\\Users\\Technology & Innovation\\Webscraping files\\US_data\\data
also, you can change your current directory.
Changing your current directory will help you because you can write read.csv("filename.csv") or write.csv(name_of_file, "filename.csv") as it is without mentioning path.
If you have to write a file you have to use syntax properly.
write.csv(C:\\Users\\Technology & Innovation\\Webscraping files\\US_data\\data,"filename.csv")

ASP MVC WriteLiteral("\r\n"); Unrecognized escape sequence error

my asp MVC Projects Builds successfully but when i try to run any view i am getting Unrecognized escape sequence error and Error Describes WriteLiteral("\r\n");
Source File: c:\Users\Mohamed\AppData\Local\Temp\Temporary ASP.NET Files\vs\1bc13a3b\8a6f90dd\App_Web_index.cshtml.a8d08dba.teskwqdt.0.cs Line: 1194
I have no Idea where this line is written WriteLiteral("\r\n");
finally i got the problem and solved it.
while i was trying to remove Extra Javascript code lines added by a virus to all my views with Find & Replace i left a whitespace-like character after this line;
And Finally Removing Those Characters From all views Manually Solved the Problem !

Fatal error: UnCSS: could not open

I'm trying to remove all of the unused css in the framework I'm using by using uncss. But when I try I get the error:
file:///C:/Users/Angus/Desktop/FTTL%20website%20submit/index.html:15 in onload
Fatal error: UnCSS: could not open C:\Users\Angus\Desktop\FTTL website%20submit\css\main.css
Does anyone know why this is?
Iyou forget to handle the first space properly (FTTL website%20submit) in the path, if you change the folder name or escape it properly (like FTTL%20website%20submit) it might work.
Edit: Or the other way around and the %20 substitution for the path was not working for the second space. (I am not familiar with uncss.)
(In my opinion it is best not using spaces in file and folder names.)

Installscript CopyFile Function Error

I am trying to copy a file using Installscript copy file function:
bRet=CopyFile( szUnattendIni, szStatusFile );
where the file referred by szUnattendIni is passed as command line argument.
When I pass this file from commandline using double quotes, bRet returns an error saying "System cannot find the file specified"...but when I pass the same name without double quotes, it works fine.
I tried adding a check before copying to verify whether source file exists using:
if(Is( FILE_EXISTS,szUnattendIni)) then
MessageBox("File Exists",INFORMATION);
endif;
In both the cases, the message box is displayed saying the file exists.
I want to support paths with directory name containing spaces for which double quotes is required. But I am not able to. How can I fix this problem.
I found the answer, it is an issue with the Installscript CopyFile function.
Refer to the link below:
http://kb.flexerasoftware.com/selfservice/viewContent.do?externalID=Q105860

Avoid message "-​- Loading resources from .sqliterc"

Minor problem, nevertheless irritating : Is there a way to avoid the following message from appearing each time I make a query :
-- Loading resources from /Users/ThG/.sqliterc
As a stupid workaround, this works:
<. sqlite your_sqlite.db 'select * from your_table'
This is because the current code does this:
if( stdin_is_interactive ){
utf8_printf(stderr,"-- Loading resources from %s\n",sqliterc);
}
Forcing a stdin redirect thwarts this due to this piece of code:
stdin_is_interactive = isatty(0);
This works as well:
sqlite -batch your_sqlite.db 'select * from your_table'
due to this piece of code:
}else if( strcmp(z,"-batch")==0 ){
/* Need to check for batch mode here to so we can avoid printing
** informational messages (like from process_sqliterc) before
** we do the actual processing of arguments later in a second pass.
*/
stdin_is_interactive = 0;
}
but it's longer, so kind of defeats the purpose.
I know that this question is PRETTY old now, but simply deleting '/Users/ThG/.sqliterc' should solve the problem. '.sqliterc' is a configuration file for sqlite's interactive command line front-end. If you don't spend a lot of time in there, you won't miss the file.
That resource msg comes out on stderr, and it's followed by a blank line, so you could get rid of it with something like this (wrapped up in a script file of its own):
#!/bin/bash
sqlite3 -init /your/init/file /your/sqlite3/file.db "
your
SQL
cmds
" 2>/dev/null | sed -e1d
When using sqlite in shell scripts, you usually don't even want your ~/.sqliterc to be loaded at all. This works well for me:
sqlite3 -init <(echo)
Explanation:
-init specifies the file to load instead of ~/.sqliterc.
<(echo) uses Process Substitution to provide a path to a temporary empty file.
A bit late but #levant pied almost had the solution, you need to pass an additional -interactive to silence the --loading resources from.
$ sqlite3 -batch -interactive
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> .q
You can simply rename your config file to disable the warning. And revert the rename to keep the configuration after use.
I use the following:
#suppress default configuration warnings
mv $HOME/.sqliterc $HOME/.backup.sqliterc
# sqlite3 scripts...
#revert
mv $HOME/.backup.sqliterc $HOME/.sqliterc

Resources