cscope cannot use in vim - c

I cannot use cscope in vim. The commands below are not work
:cs find s {name}
:cs find c {name}
...
The error code is about "E259 No matches found..." but I add and execute the database exactly.
I use :cs show to show the database I use, and there is nothing wrong.
Here are the command I build:
find "$(pwd -P)" -name "*.c" -o -name "*.h" > cscope.files
cscope -Rbqk -i cscope.files
and I set the :cs add /path/to/database/cscope.out in .vimrc
By build and add database with absolute paths, I think I can get the database in every c files in any subfolders.
The weird thing is, I can use cscope and find the symbol by:
cscope -Rqk -i cscope.files
I think something wrong about my vim but I don't know how to figure out.
Please, I need some helps.

You should consult cscope-intro help tag:
:help cscope-intro
(in the vim screen)
to get the full help to the interace of vim to cscope. It requires to build the database to use from your source files first, so probably the used database is empty and that's the reason you don't find anything.
Vim's cscope commands are an interface (as it is told in the help page I recommended you to use) to the cscope shell command, so the most probable cause that it doesn't work is that you have not established a database to consult when using it.

Related

Creating mongoDB alias with .bash_profile on the cmder is not working

this is my first ever question. Okay..
Relevant to this problem :
I am using cmder
I am new to the terminal
I am using a windows PC
I'm following a tutorial on how to install mongoDB locally, after running the setup my first problem came when
On the terminal The tutor did
Cd ~
To go to the home directory but when I tried the same command on the cmder I received
The system cannot find the path specified
So I navigated manually using "cd.. " to
c:\Users\<username>
Which I think is the home directory,I created the ".bash_profile" file and saved the following commands in it
alias mongod = "/c/program\ files/MongoDB/server/4.4/bin/mongod.exe"
alias mongo = "/c/program\ files/MongoDB/server/4.4/bin/mongo.exe"
But when I run the mongod or test if it's installed completely it returns
'mongod' is not recognized as an internal or external command, operable program or batch file
Please I don't know my way round the terminal that much, please be detailed with answers
Thanks in advance
alias mongod="/c/Program\ Files/MongoDB/server/4.4/bin/mongod.exe"
alias mongo="/c/Program\ Files/MongoDB/server/4.4/bin/mongo.exe"
Removing spaces and making uppercase the first letters of program files worked for me.
cmder doesn't interpret shell arguments like ~, which means tilde won't work in paths. Also, be aware the way you spelled Cd. It can cause an error in other command line tools (case sensitive ones like Git Bash).
1 - If you're using cmder/cmd.
Use doskey to create an alias/shortcut:
Create C:\bat\macros.txt to store your macros/aliases and paste:
cdhome=cd /d %HOMEDRIVE%%HOMEPATH%
mongo="C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe" $*
mongod="C:\Program Files\MongoDB\Server\4.4\bin\mongod.exe" $*
Rename everything you want but %HOMEDRIVE%%HOMEPATH%. $* at the end means the command accepts arguments, like mongo --version.
Keep in mind that .bash_profile isn't related with cmder/cmd, that's why your mongo commands are there too.
Then Windows + R and type regedit.
Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\
Right-click and add a new "String Value". Name it Autorun.
Right-click it and modify the value data to DOSKEY /MACROFILE="C:\bat\macros.txt"
2 - If you're using Git Bash, Hyper terminal, etc.
On .bash_profile, just remove the spaces around the equals sign. Like:
alias mongod="/c/program\ files/MongoDB/server/4.4/bin/mongod.exe"
alias mongo="/c/program\ files/MongoDB/server/4.4/bin/mongo.exe"
or on Windows, you can just go to System properties/Advanced/Environment Variables. Under System variables, find the Variable called Path. Click edit, then New and paste in the path of the mongoDB bin folder:
C:\Program Files\MongoDB\Server\4.4\bin
keep in mind to write version your mongodb correctly in path, now its 4.4
By adding a path to the path variable you can access the .exe files from that path no matter where you are in the directory. It serves the same purpose as the .bash_profile file. Doing it this way allows this to work with windows cmd prompt or cmder as well. Upon launching, the bash emulator gets the environment variables from Windows anyways.
After adding the mongoDB path, open cmd prompt or any bash emulator and type in mongo. It will load up mongo.exe regardless of your current working directory.
Be Specific about the spaces after alias.
alias alias_name ="path.."
I faced alot of issues despite so many answers so this worked for me.
1.First install git and hyper terminal
2.Click the '~' sign to enter the home directory and then make a new file ".bash_profile"
Enter the command "vim .bash_profile"
Now enter 'i' key to enter the insert mode
Copy paste the exact command below:
alias mongod="C:/Program\ Files/MongoDB/Server/5.0/bin/mongod.exe"
alias mongo="C:/Program\ Files/MongoDB/Server/5.0/bin/mongo.exe"
(make sure that you use forward slash '/' for path and "\" backward slash to indicate space between program and files)
enter esc
write the command ':wq!' and click enter
restart hyper terminal and check the installation by running the command 'mongo --version'
Use git bash instead of CMDER
OR
Try to install mongosh from this link:
[1]: https://www.mongodb.com/try/download/shell?jmp=docs
And after setup go to hyper terminal and write mongosh => to connect to MongoDB on port 27017 and then you will see => test>
now you are ready to use the Database and you can write help to see Shell Help.
Check if mongo.exe or mongod.exe files are exist. In my case the bin directory had mongos.exe instead of mongo.exe.

drupal 7 drush cc all gives a bracket ( } )

When I do Drush cc all for my Drupal project it gives me a }. so somewhere in my code is a bracket } to much.
I have more than 1000 php files. is there some way to find it easily?
drush cc all
}
all cache was cleared in /opt/drupal web [success]
I work on Ubuntu and use phpstorm
If the issue is in one of your PHP files, you might use an automated code-checking tool. PHP CLI offers the php -l option. Otherwise, you can use PHPLint: http://www.icosaedro.it/phplint/
EDIT: For instance, from your Ubuntu terminal, you might use a command like the following for all your *.module files:
find . -name "*.module" -exec php -l {} \;
(you can add more extensions to the find command if necessary, see https://superuser.com/questions/416425/using-find-for-multiple-file-extensions for details.
Hope it helps,

Find batch command to copy relative path not working

First of all, I don't know Batch programming at all. I came across a FIND command in a tutorial I was reading about OpenCV
http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html
find ./positive_images -iname "*.jpg" > positives.txt
It basically is supposed to copy all the relative paths of all the jpeg files inside positive_images directory to positives.txt file. I ran this in CMD(as Administrator) and got the following:
What is the meaning of Access Denied? I don't want to learn Batch Programming for this as I am already busy in my project. Please give me a simple-to-understand solution.
The referred tutorial uses the bash find command.But you're executing the Windows find command.Download from somewhere the windows port for the unix command put it in your directory and call it like
.\find.exe .\positive_images -iname "*.jpg" > positives.txt
mind also the windows path separator slashes.
you can use this port for example -> http://unxutils.sourceforge.net/
(probably there's a newer port but this should do the work)

Cakephp Cake command returns No such file or directory

I have been using the cake command on my linux server for 2 years. but now im trying to move to a new server and some how the cake command gives back the error: No such file or directory
even if i give the entire path to the cake command file chmod 777 it stil wont work.
I found the solution: All I had to do is use the program dos2unix the cake file for CakePHP 2.4.2 has wrong endings when you download it with Ubuntu 13.10
I used the following command:
sudo dos2unix /path/to/cake/lib/Cake/Console/cake
I also have this problem on some servers and never figured out why this happened. I suspect the so called "shebang" might not be set correctly for every Linux distribution (e.g. if the cake script stars with #!/usr/bin/env bash, but you don't use bash on your server or your distribution doesn't have the env binary in that path, it might fail on that. This is just a theory though, as I said I never really figured it out, nor did I invest much time in investigating.
Although, what I always use as a fallback is simply calling the cake.php script (from the app folder) instead, like:
php Console/cake.php -app `pwd` bake
That never lets me down. The -app pwd bit is to tell the shell that your current directory is your app directory, so the shell can find all your files.
The REAL solution to this is to change the End-of-Line (EOL) characters to Unix format, instead of MsDos. So I guess this error will only occur if you worked in Windows.
Anyway, teh mighty
SOLUTION:
(1) Open app/Console/cake file using any text editor that allows changing of EOL characters e.g. NotePad++.
(2) In NotePad++ click:
Edit -> EOL Conversion -> Convert to Unix format
(3) Save the file and upload it to the server. Now if you navigate to the CakePHP app directory using command like:
cd /usr/share/nginx/html/cakeproject/app
...you should be able to run Console/cake without any problems and see standard output (basically help commands).
Hope this helped you!
I encountered the same problem as well, but the top answer reminded me of a similar problem I faced before: https://stackoverflow.com/a/5514351/1097483
Basically, instead of using dos2unix or installing it, you can open the file in vim, do
:set fileformat=unix
And save it.
In some versions it's possible to install cake using sudo apt-get install cakephp-scripts.
After instalation, you coud access bake anywere simple by typing bake

Cygwin ssh - Identity file not accessible

I've been trying to make ssh connection using Cygwin, but it doesn't recognize my id_rsa public key file.
My command lines are as follows:
$ssh XXX#XXX -i /home/XXX/.ssh/id_rsa
Warning: Identity file /home/XXX/.ssh/id_rsa not accessible: No such file or directory.
Permission denied (publickey,XXX).
(Sorry, I used XXX for the private information.)
I copied my .pub file to C:\cygwin\home\XXX.ssh folder. But it still spits out the same error message.
Thank you so much in advance.
Background
Most cygwin executables, map Unix path /home/XXX/.ssh/id_rsa to Windows path C:\cygwin64\home\XXX\.ssh\id_rsa. Except that ssh.exe maps the same Unix path to Windows path C:\home\XXX\.ssh\id_rsa.
That is if you do cat ~/.ssh/id_rsa, it will print out the contents of C:\cygwin64\home\XXX\.ssh\id_rsa, but if you do ssh XXX#XXX -i /home/XXX/.ssh/id_rsa it will try to read the key from C:\home\XXX\.ssh\id_rsa.
I assume this is bug in Cygwin. In any event, this is a workaround that worked for me (on Windows 10 and the latest version of Cygwin as of October 2020).
Solution
Open Administrator command prompt. Go to C:\ and issue the command mklink /D home c:\cygwin64\home
That's it.
But for me tat least, once I solved the above problem, I started getting the problem described in this Superuser question https://superuser.com/questions/1296024/windows-ssh-permissions-for-private-key-are-too-open. I used the solution from the most upvoted answer and ssh finally worked for me.
From your post it looks like SSH is looking for /home/XXX/.ssh/id_rsa and is not finding it. Ensure that the .pub file you copied is named correctly and has the right permissions.
Try putting the option before the hostname...

Resources