MacVim and netrw - Press ENTER - macvim

I've set up MacVim to work with netrw for remote editing (yaaay!), but whenever I save a file, I get the following error:
:!scp -q '/var/folders/PN/PNhWJAr5GGC0WfeLdFgWV++++TU/-Tmp-/v771493/0' 'remot_host:path/remote_file.css'
Press ENTER or type command to continue
Hitting Enter removes it and I can edit again. I don't know what it is and it's annoying, but perhaps not broken.
Tips?

I realized this problem wasn't unique to MacVim and thus looked in the pi_netrw documentation (help netrw-p10).
set cmdheight=3 in .vimrc removes the prompt when saving a file, but not when opening. That is an enough solution for me.

It's probably much better to change it temporary, while reading new file:
au BufReadPre * set cmdheight=3
au BufReadPost * set cmdheight=1
au BufWritePre * set cmdheight=3
au BufWritePost * set cmdheight=1

Related

MYSQL codes not being read

When I input a code or anything into MySQL and hit "enter" it moves down and "->" appears. It is as if the code is not going through or the code is not being read.
I have attempted to download "add-ons" but I am really not sure what I am doing. This is for school and I am having trouble getting in touch with the professor.
I am new to this and can't figure out what I am doing wrong. Please help!
Please see image of what it looks like to me.
Please add semicolon ; after the mysql code.
Problem 1: Be aware of the prompt. Either of these
MariaDB >
mysql >
means that you are inside the MySQL commandline tool. You can enter only SQL statements. Most SQL queries need to be terminated by a ; or \G (but not both). To exit that tool:
exit
Or, if you get stuck in certain ways
CTRL-C
exit
Each of these implies a shell script:
$
#
mymachine$
/usr/home/rj $
C:\Users\rj:
and many others
Problem 2: mysqldump is a command, not SQL. So it needs to be executed in a shell script.
Problem 3: There is yet another problem. When it suggested typing 'help;', it did not mean for you to include the quotes. Instead, type just help;.

Couldn't access to db with Zencart

Trying to copy a zencart website in another server, but after openning the right port and copying the database, i have this error while openning the url in an internet browser.
0 DB_ERROR_NOT_CONNECTED
in:
[select * from project_version WHERE project_version_key = 'Zen-Cart Database' ]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
Does'nt anyone already encounter this error ? Or have suggestion of how to solv this ?
Tx
Something in includes/configure.php is wrong. Check each of these values very carefully:
define('DB_PREFIX', '');
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', '');
define('DB_SERVER_PASSWORD', '');
define('DB_DATABASE', '');
You likely have a typo in one of them, or perhaps you forgot to specify the prefix.
For anyone which encounter the same problem.
It comes from the fact that the password were saved in an old format on mysql.
You should migrate them to the new format to solv this issue:
update user set password=password('<my_password>') where user = '<my_user>';
flush privileges;

Can i change the locale oon MySQL Source-Configuration Options

I've been working on MySQL recently, and I'm changing the default settings to my convenience. I change the locale from 'en_US' to 'es_PA' because this is where I live, and I want to check the time format that way.
The thing is that normally, every time I turn on my Rpi and enter the MySQL server, the locale is at 'en_US'. so I enter the super user and do this:
set global lc_time_names = 'es_PA';
So that changes everyone's locale. But whenever I disconnect from the server, and turn off the Rpi, the locale changes back to 'en_US'.
So, my questions are two:
Am I changing the locale right?
Is there a way i can change it by default on the my.cnf like I did with the UTF8 (character-set)?
Thanks.
You can specify all long options to MySQL as a .my.cnf setting. There is an --init-command option, which you can use to always execute when connecting. So, if you set the variable in that command, you're good to go.
Something like this should work:
[mysql]
init_command="SET lc_time_names='es_PA';"

Batch Duplicate Script

I made a batch script that duplicates the file I specify when opening the file via the command line. This is the script:
setlocal
set file=%1
for /f %%i in ("%file%") do (
set drv=%%~di
set path=%%~pi
set ext=%%~xi
set name=%%~ni
)
copy "%1" "%drv%%path%%name% - Duplicate%ext%"
pause
And this is the command I use:
D:\> "duplicate.bat" D:\testfile.txt
This example works perfectly, but when I have a space in the file name, for example:
D:\> "duplicate.bat" D:\test file.txt
The batch file reads the file name as test and the extension is left blank.
Hopefully this is possible :)
Ok, so thanks to madhawa priyashantha for helping with that problem, but now I realise that if I wan't to hide the cmd window that pops up when I run the script, I can use this solution here, but now the script fails to work on files with spaces again. Hopefully this is the last thing I need to do. :)
this is tested and working .if you want to pass argument which consist spaces you need to wrap your argument otherwise bat consider next part after space as a next argument
#echo off
copy %1 "%~n1 - Duplicate%~x1"
pause
now you need to call this bat file like this
m.bat "D:\test file.txt"
and if no spaces,
m.bat "D:\testfile.txt"
Try.
D:> "duplicate.bat" "D:\test file.txt"

Pasting SQL into the MySQL command line

I have an application that is defining some SQL code:
mySql = "SELECT
sq.question,
qs.title,
sq.id as question_id,
sq.type,
qs.id as option_id,
sri.title as rankTitle,
sri.id as rankId,
sfi.title as formTitle,
sfi.id as formId,
sq.sub_type,
sq.sort_order
FROM survey_questions as sq
LEFT JOIN question_suboptions as qs
ON sq.id = qs.question_id
LEFT JOIN survey_rankingitems as sri
ON sq.id = sri.question_id
LEFT JOIN survey_formitems as sfi
ON sq.id = sfi.question_id
WHERE sq.survey_id = #{#surveyId}
ORDER BY sq.sort_order"
I would like to paste this code (everything between the double quotes) in the MySQL command line, change the one parameter and execute it, but I have run into an issue where for every line above MySQL will display:
Display all 1450 possibilities? (y or n)
And then 1450 different available commands. If I remove all linebreaks and tabs then I can paste in, but that is time consuming and a pain. Is there a way that I can simply paste in the above code, edit it and then execute it as a single unit?
This is the default mysql (CLI) behavior each time the user presses the Tab key (mysql uses the underlying readline or EditLine libraries (not on Windows)).
By default, when the user requests to use a database, mysql reads tables and fields definitions. Then, pressing the Tab key makes mysql conveniently offers completion of the current input with the known tables and fields.
However, pasting some text into mysql that contains TAB characters (\t or 0x09) triggers the same behavior - even though no Tab key was actually pressed from the keyboard. And this can be annoying.
Two options given to mysql can prevent that behavior, though. My favorite is --disable-auto-rehash. The other one is --quiet or -q.
--disable-auto-rehash to prevent database, table, and column name completion (which are not read from the database, use the rehash command if later on you need completion). Commands history is kept, though (retrieved via the ↑ and ↓ keys for instance). Which is convenient.
--quick or -q which makes mysql not using the history file and no completion (does not read the database definitions).
On Linux one may add an alias in .bashrc to use --disable-auto-rehash automatically
alias mysql2='mysql --disable-auto-rehash'
Perhaps you could save the statement to a text file myTest.sql, then use the MySQL command source myTest.sql to run it? You could then tweak the SQL in the file, save the changes, and run it again.
You need to remove the line breaks and tabs. The double tab is causing it to display the Display all 1450 possibilities? (y or n) and the line breaks are causing it to execute early.
If it's PHP, write a little script to strip it for you:
echo (preg_replace("/\s+/", " ", $string));
Or something similar for other languages.
Breaking not so bad's answer explained the cause of this problem really well.
From the question:
If I remove all linebreaks and tabs then I can paste in, but that is time consuming and a pain.
In my case, I just replaced the tabs with spaces and I was able to paste the query just fine. The MySQL console doesn't seem to care about the newlines, just the tabs.
As a way to prevent this, most editors have a setting that will insert tabs instead of spaces when you press the Tab key. I normally have my IDEs configured this way, but in this instance it was a query I'd copied from MySQL workbench. Conveniently, it also has a setting to use spaces instead of tabs:
Edit > Preferences > General Editors > check Tab key inserts spaces instead of tabs > OK