我已经下载了许多vim颜色模式并尝试了它们,但其中许多看起来不像官方截图.
例如,vim自己的颜色模式 - desert
应该如下所示:
但在我的vim中,很多颜色都不会显示,例如背景.
但是一些颜色模式正常工作.
这是为什么?
在:编辑 - >配置文件首选项 - >颜色,我选择"使用系统主题颜色"
我试着r+
和a+
打开文件和读取和写入,但"R +"和"A +"都是STR附加到文件末尾.
那么,r+
和之间的区别是a+
什么?
加:
我找到了原因:
我已经读取了文件对象,忘了寻找(0)将位置设置为开始
在Windows中,Python有一个chm类型的文档,阅读起来非常方便.但在Linux中,是否有任何文件让我阅读?
当我复制一个python代码,并粘贴到vim.缩进都是错误.但我粘贴到emacs或gedit,这是对的.
这很难描述,让我们看一下截图.注意:蓝色和黄色线只是使用"缩进指南插件".
这是源代码示例:
import threading
import time
class timer(threading.Thread): #The timer class is derived from the class threading.Thread
def __init__(self, num, interval):
threading.Thread.__init__(self)
self.thread_num = num
self.interval = interval
self.thread_stop = False
def run(self): #Overwrite run() method, put what you want the thread do here
while not self.thread_stop:
print 'Thread Object(%d), Time:%s/n' %(self.thread_num, time.ctime())
time.sleep(self.interval)
def stop(self):
self.thread_stop = True
def test():
thread1 = timer(1, 1)
thread2 = timer(2, 2)
thread1.start()
thread2.start()
time.sleep(10)
thread1.stop()
thread2.stop()
return
if __name__ == '__main__': …
Run Code Online (Sandbox Code Playgroud) 这是C++
代码:
#include<iostream>
using namespace std;
int a=8;
int fun(int &a)
{
a=a*a;
return a;
}
int main()
{
cout << a << endl \
<< fun(a) << endl \
<< a << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
为什么输出:
64 64 8
该<<
运营商的关联性为从左到右,那么为什么不输出8 64 64
?
它与序列点和效果方面有关系吗?
在man git-merge doc中,git merge -s recursive -X ours
:
这不应该与我们的合并策略混淆,后者甚至不会查看其他树包含的内容.它丢弃了另一棵树所做的一切,宣告我们的历史包含了其中发生的一切.
我测试过这两个但是找不到差别.
有一个例子可以说明这两者之间的区别是什么?
我的git版本是 git version 1.8.3.4
Python脚本的shebang应该怎么样?
有些人支持,#!/usr/bin/env python
因为它可以智能地找到Python解释器.其他人支持#!/usr/bin/python
,因为现在大多数GNU/Linux发行版python
都是默认程序.
这两种变体有什么好处?
我有一个html作为侧边栏,并使用Bootstrap
.
<ul class="nav nav-list">
<li class="active"><a href="/">Link 1</a></li>
<li><a href="/link2">Link 2</a></li>
<li><a href="/link3">Link 3</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我打算做点什么:
当我click
链接3之类的链接时,page content
将更改为链接3的内容,链接3将具有类active
,并删除链接1中的活动clss.
我认为这可以实现jQuery
,我在SO中搜索了很多问题,例如:
我用这个脚本:
$(document).ready(function () {
$('.nav li').click(function(e) {
$('.nav li').removeClass('active');
var $this = $(this);
if (!$this.hasClass('active')) {
$this.addClass('active');
}
//e.preventDefault();
});
});
Run Code Online (Sandbox Code Playgroud)
但是大多数人都使用preventDefault
,这将阻止继续行动.因此它无法更改为Link 3的页面内容.
如果我删除了preventDefault语句,当页面加载Link 3的内容时,活动类将返回到Link 1.
那么有什么方法可以解决这个问题吗?
我有一个Tornado程序,所有相对的python lib安装在一个名为bob的非root用户中:
pip install --user xxx
Run Code Online (Sandbox Code Playgroud)
现在我想在主管中运行它:
[program:testpro]
command=python /path/to/myfile.py
user=bob ; set the user to bob
redirect_stderr=true
stdout_logfile=/path/to/log
numproces=1
autostart=true
Run Code Online (Sandbox Code Playgroud)
但它在supervisorctl状态下失败了:
testpro FATAL Exited too quickly (process log may have details)
Run Code Online (Sandbox Code Playgroud)
我看到日志并发现它无法导入相对的python库,所以它不能像bob一样运行.
然后我改为:
[program:testpro]
command=sudo -u bob -i python /path/to/myfile.py
;user=bob ;comment this
redirect_stderr=true
stdout_logfile=/path/to/log
numproces=1
autostart=true
Run Code Online (Sandbox Code Playgroud)
它运行正常
那么,该选项有user
什么作用?以及如何在选项中配置run-as用户?