使用redis时
==MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.==
原因: 强制关闭Redis快照导致不能持久化。
解决方案: 运行config set stop-writes-on-bgsave-error no 命令后,关闭配置项stop-writes-on-bgsave-error解决该问题。
root@ubuntu:/usr/local/redis/bin# ./redis-cli
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
==linux下使用&将程序挂到后台后查询进程使用ps aux|grep 执行的语句名(python manage runserver)==
h=[1,2,3]
k=(4,5,6)
d={'a':7,'b':8,'c':9}
def f2(arg,arg2,*args,**kwargs):
...: print(arg,arg2,args,kwargs)
...:
f2(1,2,3,a=1,b=2,c=3)
1 2 (3,) {'a': 1, 'b': 2, 'c': 3}
f2(*h,*k,**d)
1 2 (3, 4, 5, 6) {'a': 7, 'b': 8, 'c': 9}
f2(h,k,**d)
[1, 2, 3] (4, 5, 6) () {'a': 7, 'b': 8, 'c': 9}
f2(h,k,d)
[1, 2, 3] (4, 5, 6) ({'a': 7, 'b': 8, 'c': 9},) {}
一次完整的http请求
- 域名解析
- 发起TCP的3次握手
- 建立TCP连接后发起http请求
- 服务器端响应http请求,浏览器得到html代码
- 浏览器解析html代码,并请求html代码中的资源
- 浏览器对页面进行渲染呈献给用户
关于git # 请输入一个提交信息以解释此合并的必要性,尤其是将一个更新后的上游分支 # 合并到主题分支。
正常使用 git pull的过程中,总能出现这种情况,冲突!
在MAC下的解决方法,亲测可用: Please enter a commit message to explain why this merge is necessary,especially if it merges an updated upstream into a topic branch 没有图确实有些抽象,我也只能凭借回忆了: 在出现需要你输入新的merge信息的终端窗口,在最上面的提示句下有一行空格,按照链接的帮助,按”i”进入输入模式,随便输入个什么,然后 esc,直接输入”:wq”你会发现这个出现在终端的最下面,这是OK的,最后 enter,就OK了。
在Ubuntu下的解决方法: 网上会有很多关于原理的解释,,我这边的具体操作: ubuntu下不需要键入 i 就可以直接输入merge信息,你可以参照Mac我说的步骤,输入merge信息后直接ctrl+x,然后终端会问你是否保存最新缓冲区,选择保存,然后还会有一个次问你把最新的merge信息保存到那个文件,我没有创建新的文件,直接Enter,就OK,然后你就会看到一堆 正常 merge 的信息。说的话实在是有些抽象,不过我尽量说的详细了,也是为了以后自己忘了,大家有什么步骤不明白可以直接问。*
关于windows安装rabbitmq的问题 首先rabbitmq基于erlang语言,所以要先装erlang的解释器 http://www.erlang.org/downloads
# 如果看到类似的错误有两种解决方案
λ rabbitmqctl.bat list_queues
Error: unable to perform an operation on node 'rabbit@PC201709292146'. Please see diagnostics information and suggesti
ons below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the serve
r)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@PC201709292146
DIAGNOSTICS
===========
attempted to contact: [rabbit@PC201709292146]
rabbit@PC201709292146:
* connected to epmd (port 4369) on PC201709292146
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* TCP connection succeeded but Erlang distribution failed
* Authentication failed (rejected by the remote node), please check the Erlang cookie
Current node details:
* node name: rabbitmqcli60@PC201709292146
* effective user's home directory: C:\Users\wjy
* Erlang cookie hash: Rk2R4OnSFdBt4YoLsK92TQ==
1、重新安装RabbitMQ的服务
For some reason the service set up by the installer did not configure several registry entries. Running this set them correctly and allowed the service to run.
这是由于某些原因在安装服务时没有正确配置注册项,重新安装服务即可解决:
以管理员身份运行RabbitMQ Command Propmt(开始菜单中)
执行rabbitmq-service remove
执行rabbitmq-service install
然后再测试是否成功。
2、更正Erlang的cookie
Erlang会生成两个cookie文件:C:\Windows.erlang.cookie 及 C:\用户\你的用户名.erlang.cookie。检查两个文件内容是否一致,不一致用其中一个替换另一个即可。
我这里用第二种方式解决了问题,正如程序提示是cookie不正确所导致。
目前还不清楚为何会这样,网上查阅的资料很多都是集群才会出现这种情况,可能是bug,有待探究。
==以下这种错误是因为basic_consume中添加了no_ack参数==
pika.exceptions.ChannelClosed: (406, 'PRECONDITION_FAILED - unknown delivery tag 1')
==这种错误是因为队列还没有被创建需要先发一次消息==
pika.exceptions.ChannelClosed: (404, "NOT_FOUND - no queue 'task' in vhost '/'")
1 红帽长使用yun -y install tkinter时
2 --现象:
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory 坏的解释器: 没有那个文件或目录
--查找python
#whereis python
python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4 /usr/local/bin/python2.7 /usr/local/bin/python /usr/local/bin/python2.7-config /usr/local/lib/python2.7 /usr/share/man/man1/python.1.gz
--查找yum
#whereis yum
yum: /usr/bin/yum /etc/yum.conf /etc/yum /usr/share/man/man8/yum.8.gz
--修改
#vi /usr/bin/yum
将首行的#!/usr/bin/python
更改成 #!/usr/bin/python2.4
保存退出!
这个错误是因为python的版本不匹配,只要在/usr/bin/yum中把第一行的#!/usr/bin/python改成#!/usr /bin/python2.4就可以啦~当然,我是指路径对的情况下,毕竟通常linux下的python默认版本都是2.4,当然,例外不算。
关于centos7
yum安装软件报错:curl#6 - "Could not resolve host: mirrorlist.centos.org; Temporary failure in name resolut
# yum install -y epel-release
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Temporary failure in name resolution"
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Disable the repository, so yum won't use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
--enablerepo for temporary usage:
yum-config-manager --disable <repoid>
4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
dns解析的问题,处理办法:
vim /etc/resolv.conf 加入:
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
git问题
fatal: 拒绝合并无关的历史
$ git pull origin master --allow-unrelated-histories
django使用mysql的问题
pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'172.17.0.1' (using password: NO)")
说明没有给远程权限
使用mysql>grant all privileges on . to root@'%' identified by "password";修改权限
新版mysql8.0也许不支持这个命令
配置docker的mysql需要使用
docker run --name mysql5.7 -p 3306:3306 -v /my/mysql/datadir:/var/lib/mysql -v /my/mysql/conf.d:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7 命令解析: --name:容器名
--p:映射宿主主机端口
-v:挂载宿主目录到容器目录
-e:设置环境变量,此处指定root密码
-d:后台运行容器
5 测试是否成功
mysql -h192.168.2.102 -p3306 -uroot -p
python代码测试
nnect = pymysql.connect(host='172.17.0.2', port=3306, user='root', passwd='123456', db='Blog', charset='utf8')
cur = connect.cursor()
cur.execute('show tables;')
connect.commit()
print(cur.fetchall())
安装bro时openssl不能使用1.1版本使用1.0命令
直接安装openssl1.0版本,Debian 系:apt-get install libssl1.0-dev
关于UnicodeDecodeError: 'utf8' codec can't decode byte 0xe6 in position 0: unexpected end of data
解决办法
在中文后加.decode("utf-8") 设置为utf-8
assert '时间'.decode("utf-8") in self.driver.title
censtos
使用sudo时显示
** 不在 sudoers 文件中。此事将被报告。
先用su root登录到root用户
修改/etc/sudoers文件,找到下面一行,在root下面添加一行,如下所示:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
修改完毕用 ==wq!== 保存,用自己的帐号登录,然后用命令su –,即可获得root权限进行操作。
centos下安装chrome浏览器 1.配置yum下载源:
在目录 /etc/yum.repos.d/ 下新建文件 google-chrome.repo, 并且在该文件中添加如下内容:
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
- 安装google chrome浏览器:
[root@localhost yum.repos.d]# yum -y install google-chrome-stable
PS: Google官方源可能在中国无法使用,导致安装失败或者在国内无法更新,可以添加以下参数来安装:
[root@localhost yum.repos.d]# yum -y install google-chrome-stable --nogpgcheck
centos安装pip
方式1(yum安装):
1、首先安装epel扩展源:
[root@localhost ~]# yum -y install epel-release
如果没有安装epel扩展源而直接安装python-pip时,会出现找到该软件包的错误。 这是因为像centos这类衍生出来的发行版,他们的源有时候内容更新的比较滞后,或者说有时候一些扩展的源根本就没有。
2、安装pip
[root@localhost ~]# yum -y install python-pip
3、更新pip
[root@localhost ~]# pip install --upgrade pip
4、安装后清除cache
[root@localhost ~]# yum clean all
方式2(源码安装):
[root@localhost ~]# wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
注意:wget获取https的时候要加上:--no-check-certificate
[root@localhost ~]# tar zvxf 1.5.5.tar.gz #解压文件
[root@localhost pip-1.5.5]# cd pip-1.5.5/
[root@localhost pip-1.5.5]# python setup.py install
方式3(get-pip安装):
[root@localhost ~]# curl https://bootstrap.pypa.io/get-pip.py | python
ubuntu无法记住dns信息
vi /etc/resolv.conf
vi /etc/resolvconf/resolv.conf.d/base
resolvconf -u
# base
nameserver 8.8.8.8
nameserver 192.168.182.2
oracle远程连接配置文件
https://jingyan.baidu.com/article/7c6fb42823ae7980652c9070.html
tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.160.135)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
listener.ora
LISTENER1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.160.135)(PORT = 1521))
)
添加环境变量 配置instantclient的环境变量:
在电脑的系统环境变量下,增加如下环境变量
1、NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
2、Path添加:G:\Program Files\instantclient_11_2
3、TNS_ADMIN=G:\Program Files\instantclient_11_2
PL/Sql配置InstantClient路径:
进入PL/Sql点击工具->首选项 出现如图配置界面
这里在左侧菜单项找到到连接,点击后会在右侧出现如图配置界面,在红色箭头标注位置替换InstantClient的解压路径
oracle主目录名:D:\Program Files\instantclient_11_2
OCI库:D:\Program Files\instantclient_11_2\oci.dll
go编译器在root用户没有添加软件启动路径修改/etc/profile文件添加
export PATH="$GOPATH:$PATH"
export GOROOT=/usr/local/go
export GOPATH=$GOROOT/bin
deepin下安装
http://itindex.net/detail/52228-geoip2-%E5%88%86%E6%9E%90-%E8%AE%BF%E9%97%AE
sudo yum install libcurl-devel -y
error: Failed dependencies: /bin/sh is needed by libcurl-devel-7.61.0-2.fc29.x86_64 /usr/bin/pkg-config is needed by libcurl-devel-7.61.0-2.fc29.x86_64 libcurl(x86-64) = 7.61.0-2.fc29 is needed by libcurl-devel-7.61.0-2.fc29.x86_64 libcurl.so.4()(64bit) is needed by libcurl-devel-7.61.0-2.fc29.x86_64
使用:
sudo apt-get install curl libcurl3 libcurl3-dev
关于 go []byte("")和[]byte{} 内存中的区别
https://www.cnblogs.com/mushroom/p/8998538.html
推荐[]byte{}
安装scrapy时缺少库
https://www.cnblogs.com/liuliliuli2017/p/6746440.html
ubuntu安装scrapy的twited失败
sudo apt-get install python-dev
sudo apt-get install libevent-dev
sudo apt-get build-dep python-lxml
sudo pip install lxml --upgrade
sudo apt-get install libxml2-dev libxslt1-dev python-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libevent-dev
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
pip install scrapy
如何解决Sublime Text 3不能正确显示中文的问题 中文乱码 sublime
1、在Sublime Text里,按ctrl+`,打开Console,一次性输入如下代码:
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
2、重启Sublime Text。
3、在Sublime Text中,按Ctrl+Shift+P打开命令行模式,输入Install Package关键字,然后点击自动出现的下拉菜单里的第一项:Package Control: Install Package。
4、此时你会看到左下角有个=号来回动,稍等一会,会再次在命令行下弹出一个下拉菜单。输入“ConvertToUTF8”或者“GBK Encoding Support”,选择匹配项。中文字符就可以正常显示了。
CentOS中用户不在 sudoers 文件中。此事将被报告。
首先切换为root用户 su root或者su -;
然后更改etc/sudoers文件的只读为可读可写可执行。
sudo chmod 777 /etc/sudoers
输入visudo命令即可编辑文件,找到root ALL=(ALL) ALL的字段
追加username ALL=(ALL) ALL,其中username为你当前需要获得root权限的用户名
5分钟之后密码过期,下次需要重新输入,如果不想如此麻烦,可以用以下方法
username ALL=(ALL) NOPASSWD: ALL
保存退出,并恢复/etc/sudoers的访问权限为440
chmod 440 /etc/sudoers
切换到普通用户,测试用户权限提升功能
ubuntu安装搜狗拼音
sudo apt remove sogoupinyin
sudo apt install libopencc1 fcitx-libs fcitx-libs-qt fonts-droid-fallback
sudo dpkg -i sogoupinyin_2.0.0.0078_amd64.deb
安装oracle客户端
- 安装MinGW
- 下载装oracle的Base和sdk
MinGW下载地址相关:http://blog.csdn.net/mecho/article/details/24305369
oracle扩展下载地址: https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
- 配置
instantclient_18_3 instantclient_18_3\sdk\include instantclient_18_3\sdk\lib\msvc mingw64\bin
tensorflow 几种警告
第一种
...Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
解决方法: 如果安装的是GPU版本
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
如果安装的是CPU版本(pip install tensorflow)
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
第二种
WARNING:...
Instructions for updating:
Use `tf.global_variables_initializer` instead.
解决方法:
tf.initialize_all_variables()替换为tf.global_variables_initializer()
第三种
FutureWarning错误...
解决方法:
对h5py进行更新升级
公钥解密
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Wjy
import M2Crypto
import base64
def pub_decrypt_from_pubkey(msg, publibkey_string):
"""
公钥解密该方法只能用于linux下
:param msg:
:param publibkey_string:
:return:
"""
bio = M2Crypto.RSA.BIO.MemoryBuffer(publibkey_string.encode())
rsa_pub = M2Crypto.RSA.load_pub_key_bio(bio)
ctxt_pri = base64.b64decode(msg)
print(ctxt_pri)
out = rsa_pub.public_decrypt(ctxt_pri, M2Crypto.RSA.pkcs1_padding)
return out
msg = "MQ+81wiIZR+yfQu2pTeCNgDEcbj67c/YGKS1UQ7DnlIOj5Dco7gkvbrh5/ZRAZsG4hNRJrJzj8fc39KIwUBHfDfnolSPbXx8EhgubPDl8vfpxQyKAV6UVDAAgwHFG+LQ1miMeP9+49kJRo89HKLTtB83BUGYtgwO7E+tioGXZBQnQtC0pYgD+s/MaHO5xkJ+JBMRRmpaBw94DGDEZYeiSK3DLJU86f36kOI3Zo3TBwnEwkCNORcoQB9LwNzpqe7ibLJAYbIDJEWKYd+WRAJ/V/D/54slD1qTU0jwqN7d5iFXlmNC54Ol65nLri8Ti+eMbfOhCb0bCLCIgiK3vXsAYg==\r"
pubk = """-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmnlYzvi5MdW43Q5SXukL
OLc0qB7/pTyJ87Et9sC8IDiUt14zmHNmQWlenFnc7U0l/CY2B3rJUFD8mPEzyEwQ
XSQDE+wGgJy6BL3wGx2Z20bMh2jrafpWOX4Z/FwGGLKeMQ7MfP27v4X8E0RAnLg3
vEQ+ST+jXqOVW5QC5mGeFthlHP+IsUpAYGBOVjmAYSpoSgbCwSInIZl2+WdoVML0
7+5JrLGkbbIgso5ycK7dAmWslSFTTlH6yNlyMwRiWey8n3+HQa1gXLY67woeg0+L
JOv98/gFXyAHYBWqefXDozA73YG3pKywXgUa83795SncmKzKO+2NdTnTr5zxmogu
MwIDAQAB
-----END PUBLIC KEY-----"""
print(pub_decrypt_from_pubkey(msg, pubk))
docker daemon.json
http://www.javamonamour.org/2018/12/
sudo systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
sudo journalctl -xe
Error starting daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: devicemapper, overlay2; Please cleanup or explicit
sudo vi /etc/docker/daemon.json
append this at the end and before the closed curly brace:
,"storage-driver": "devicemapper"
sudo systemctl reset-failed docker.service
sudo systemctl start docker.service
解决cannot find package "golang.org/x/net/proxy"
go get github.com/golang/net
解决“cannot find package "golang.org/x/crypto/ssh/terminal" in any of”
git clone https://github.com/golang/crypto.git
解决go get无法下载被墙的包、
//使用gopm(Go Package Manager)代替go下载,是go上的包管理工具,十分好用
//1. 下载安装gopm
go get -u github.com/gpmgo/gopm
//2. 使用gopm安装被墙的包
gopm get github.com/Shopify/sarama
Qt 出现“undefined reference to `vtable for”原因总结
https://blog.csdn.net/wangzhiqian7hao/article/details/83446696
造成这个原因很可能是你编写继承自QObject类及其子类的自定义类的时候,忘记加入Q_OBJECT宏造成的, 当你编译出现这个问题后, 手动加入了Q_OBJECT宏, 再次编译还是会出现这个问题, 这一次原因就很简单了,因为你重新编译,但是这次并没有重新生成xxx.pro.user文件, 这个文件是基于你机器上的具体环境配置生成的, 直接删除掉你项目中生成的xxx.pro.user文件再次编译即可