如何在Vim中替换光标下的单词.
那么代替dw那么i然后单词然后Esc,是否有一个更简单的组合来替换光标下的单词?
如果我想比较两个数组,并创建一个插值输出字符串,如果从数组的数组变量y中存在x我怎么能获得每个匹配元素的输出?
这就是我的尝试但却没有得到结果.
x = [1, 2, 4]
y = [5, 2, 4]
x.each do |num|
puts " The number #{num} is in the array" if x.include?(y.each)
end #=> [1, 2, 4]
Run Code Online (Sandbox Code Playgroud) 当尝试在ubuntu上使用带有python 3的venv创建virtulenv时,它不会创建激活脚本.它会以错误1退出.
关于SO的文档和其他帖子,例如/sf/answers/1389413931/
我尝试过2种不同的方式.
sayth@sayth-TravelMate-5740G:~/scripts$ python3 -m venv test4
Error: Command '['/home/sayth/scripts/test4/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
sayth@sayth-TravelMate-5740G:~/scripts$ source test4/bin/activate
bash: test4/bin/activate: No such file or directory
sayth@sayth-TravelMate-5740G:~/scripts$ ls test4/bin/
python python3
Run Code Online (Sandbox Code Playgroud)
要么
sayth@sayth-TravelMate-5740G:~/scripts$ pyvenv-3.4 test5
Error: Command '['/home/sayth/scripts/test5/bin/python3.4', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
sayth@sayth-TravelMate-5740G:~/scripts$ ls test5/bin/
python python3 python3.4
Run Code Online (Sandbox Code Playgroud)
我怎样才能完全创造一个venv?
如果我这样做,stil没有成功,不确定是什么问题?
sayth@sayth-TravelMate-5740G:~/scripts$ python3 -Im venv panda3
Error: Command '['/home/sayth/scripts/panda3/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
sayth@sayth-TravelMate-5740G:~/scripts$ python3 …Run Code Online (Sandbox Code Playgroud) 我正在关注Pandas教程
教程是使用python 2.7编写的,我在python 3.4中编写它们
这是我的版本细节.
In [11]: print('Python version ' + sys.version)
Python version 3.4.1 |Anaconda 2.0.1 (64-bit)| (default, Jun 11 2014, 17:27:11)
[MSC v.1600 64 bit (AMD64)]
In [12]: print('Pandas version ' + pd.__version__)
Pandas version 0.14.1
Run Code Online (Sandbox Code Playgroud)
我根据教程创建了zip
In [13]: names = ['Bob','Jessica','Mary','John','Mel']
In [14]: births = [968, 155, 77, 578, 973]
In [15]: zip?
Type: type
String form: <class 'zip'>
Namespace: Python builtin
Init definition: zip(self, *args, **kwargs)
Docstring:
zip(iter1 [,iter2 [...]]) --> zip object
Return a …Run Code Online (Sandbox Code Playgroud) 嗨,我一直在尝试在ubuntu上配置vim.
所有的软件包似乎安装得很好.但是,如果通过vundle安装colorscheme然后使用colorscheme名称,它似乎找不到该方案.
我试图安装railscast,solarized和desert-warm,但都没有加载.
这是我的.vimrc我做错了什么?
set nocompatible " be iMproved
filetype off " required!
colorscheme desert-warm
" next tab
map <F7> :tabn
" previous tab
map <F8> :tabp
" Close Tab abd save
map <F9> ZZ
" open and edit file
map <F6> :tabedit
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
" original repos on github
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
Bundle 'desert-warm-256'
" vim-scripts …Run Code Online (Sandbox Code Playgroud) 如何在SQlite for Django中查看我的数据库.
我正在关注ubuntu上的django教程.
现在它的工作正常除外.跑完之后
python manage.py sql polls
Run Code Online (Sandbox Code Playgroud)
然后
python manage.py syncdb
Run Code Online (Sandbox Code Playgroud)
那么我想我会检查daabase和表,但这是问题所在:
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main
1 temp
Run Code Online (Sandbox Code Playgroud)
没有mysite数据库.我怎么能看到数据库?
如何在Gedit的管理外部工具中指定当前的占位符.
例如,如果我想在我的外部工具中使用它,我应该使用什么?
perl -d:ptkdb my_current_file.pl
pertidy my_current_file.pl
Run Code Online (Sandbox Code Playgroud) 我无法使用带有postgres的rails.数据库不会创建:
sayth@sayth-TravelMate-5740G:~/testapp2$ rake db:create:all
PG::InsufficientPrivilege: ERROR: permission denied to create database
: CREATE DATABASE "testapp2_development" ENCODING = 'unicode'
....
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"testapp2_production", "pool"=>5, "username"=>"testapp2", "password"=>nil}
Run Code Online (Sandbox Code Playgroud)
所以我在这里按照解决方案/sf/answers/604775461/
这些是我遇到的问题.
$ psql -d postgres
postgres=# create role app_name login createdb;
postgres=# \q
Run Code Online (Sandbox Code Playgroud)
但是当我在psql shell中为createb赋予create role时,它会失败.
sayth@sayth-TravelMate-5740G:~/testapp2$ psql -d postgres
psql (9.2.4)
Type "help" for help.
postgres=> create role sayth createdb;
ERROR: permission denied to create role
postgres=>
Run Code Online (Sandbox Code Playgroud)
那怎么创建auth?
编辑更新审核http://www.postgresql.org/docs/9.2/static/tutorial-createdb.html 和http://www.postgresql.org/docs/9.2/static/database-roles.html
但是不能使用root来创建帐户,因为它不存在,我需要root才能创建帐户.
sayth@sayth-TravelMate-5740G:~$ sudo psql -d postgres …Run Code Online (Sandbox Code Playgroud) 有没有办法在C++中做到这一点,尤其是范围部分.
answer = (0..999).select { |a| a%3 ==0 || a%5==0 }
puts answer.inject { |sum, n| sum+n }
Run Code Online (Sandbox Code Playgroud)
我已经创建了自己的c ++解决方案,但使用了更标准的for循环,并想知道是否有更酷的方法来做到这一点?
我在ubuntu 11.10上安装并运行了vim-gnome.使用vundle并安装了seeral软件包.
我已经安装了命令-t但是在编译C扩展之前它不会起作用.阅读手册这是解决方案.
rake make
Run Code Online (Sandbox Code Playgroud)
对我来说,位置实际上是:
~/.vim/bundle/command-t
Run Code Online (Sandbox Code Playgroud)
无论如何,所以我关闭了rvm并按照命令-t帮助指南中的建议安装了系统1.8.我检查了文档,命令错误的最常见原因是编译错误的ruby.
所以我找到了这个命令来检查编译版本.
renshaw@renshaw-TravelMate-5740G:~/.vim/bundle/command-t$ ldd `which vim` | grep ruby
libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0x00007f913932c000)
Run Code Online (Sandbox Code Playgroud)
所以我为ruby 1.8安装了rake并使用rake make编译
renshaw@renshaw-TravelMate-5740G:~/.vim/bundle/command-t$ sudo rake make
/usr/bin/ruby1.8 extconf.rb
checking for ruby.h... yes
Run Code Online (Sandbox Code Playgroud)
然后它去编译.
但是启动gvim并运行\ t for command -t和
Vim: Caught deadly signal SEGV
Vim: Finished.
Segmentation fault
Run Code Online (Sandbox Code Playgroud)
如何在ubuntu 11.10上执行命令?
更新.
使用来源建立Gvim
hg clone https://vim.googlecode.com/hg/ vim
cd vim
sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2
make
make install
vim --version | grep ruby
Run Code Online (Sandbox Code Playgroud)
vim version命令返回正确的ruby支持是针对我安装的系统1.8构建的,但在使用命令T时它仍然是SEGV.
所以找到并尝试了这个
cd ~/.vim/ruby/command-t
/usr/bin/ruby extconf.rb
make
Run Code Online (Sandbox Code Playgroud)
这也失败了.然后我将其从之前的支持票证添加到bashrc. …
ruby ×3
vim ×3
python ×2
python-3.x ×2
ubuntu ×2
c++ ×1
django ×1
gedit ×1
pandas ×1
perl ×1
postgresql ×1
python-venv ×1
rake ×1
range ×1
replace ×1
sqlite ×1
ubuntu-11.10 ×1
virtualenv ×1