http://stackoverflow.com/questions/415677/how-to-replace-placeholders-in-a-text-file
https://my.oschina.net/iuranus/blog/279985
Wednesday, February 15, 2017
Monday, February 13, 2017
安装mysqldb
##centos 环境
sudo yum install mysql-devel
sudo pip install mysql-python
##ubuntu环境
sudo yum install mysql-devel
sudo pip install mysql-python
##ubuntu环境
Starting with a vanilla Lucid install [1], install pip and upgrade to the latest version:
apt-get install python-pip
pip install -U pip
Next, install the required development packages:
apt-get install python-dev libmysqlclient-dev
then
pip install MySQL-python
should complete successfully.
mac下安装
$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python
mac下安装
$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python
Saturday, January 7, 2017
scala 第一深坑
http://stackoverflow.com/questions/23722048/intellij-idea-13-new-scala-sbt-project-hasnt-src-directory-structure-generated
2.intellij 打开终端terminal
alt+f12
2.intellij 打开终端terminal
alt+f12
Thursday, January 5, 2017
redis-py-cluster一坑记录
按照文档例子来一发,发现错误呀,单用redis-py错误呀
>>> from rediscluster import StrictRedisCluster >>> # Requires at least one node for cluster discovery. Multiple nodes is recommended. >>> startup_nodes = [{"host": "127.0.0.1", "port": "7000"}] >>> # Note: decode_responses must be set to True when used with python3 >>> rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True) >>> rc.set("foo", "bar") True >>> print(rc.get("foo")) 'bar'
cluster错误如下:
ResponseError: unknown command 'CONFIG'
想死有没有,各种找不到答案
https://www.digitalocean.com/community/tutorials/how-to-secure-your-redis-installation-on-ubuntu-14-04
看到这篇文章,原来server可以选择屏蔽一些命令的,然后,搜索redis-py-cluster源码,找到这么一句
If your redis instance is configured to not have the `CONFIG ...` comannds enabled due to security reasons you need to pass this into the client object `skip_full_coverage_check=True`. Benefits is that the client class no longer requires the `CONFIG ...` commands to be enabled on the server. Downsides is that you can't use the option in your redis server and still use the same feature in this client.
加了一个skip_full_coverage_check=True搞定
Friday, December 16, 2016
WINDOWS SUBSYSTEM使用中遇到的问题
- sudo: unable to resolve host OPTIMISTPRIME
解决方法:http://iamnotmyself.com/2016/07/13/windows-subsystem-for-linux-error-unable-to-resolve-host-2/
编辑/etc/hosts 加入一行127.0.0.1 OPTIMISTPRIME
2.安装redis-server遇到问题如下:
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such file or directory
此问题基本使用subsystem都会遇到
解决方法:
参见:https://github.com/Microsoft/BashOnWindows/issues/365
2.安装redis-server遇到问题如下:
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such file or directory
此问题基本使用subsystem都会遇到
解决方法:
This is an issue that everyone will start seeing. We need to add something on this in our official docs.
As @nuclearmistake points out, udev is something that breaks in apt-get but the errors should not cause any issues in WSL. We have reached out to Canonical on this one asking for the best solution and they recommend the following changes:
Write the following to /usr/sbin/policy-rc.d
#!/bin/sh
exit 101
chmod +x /usr/sbin/policy-rc.d
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
I have tried this one myself and it looks to work quite well.
参见https://github.com/Microsoft/BashOnWindows/issues/143
3.直接执行redis-server启动redis,起不来,使用sudo redis-server能够启动,但是redis-cli不能联通
方法如下:
执行sudo service redis-server start
jetbrains 激活
http://jetbrains.tencent.click
IntelliJ IDEA 2016.2.4
http://idea.imsxm.com/
IntelliJ IDEA 2016.2.4
1. 到网站 http://idea.lanyus.com/ 获取注册码。
2.填入下面的license server:
http://intellij.mandroid.cn/
http://idea.imsxm.com/
http://idea.iteblog.com/key.php
http://idea.imsxm.com/
http://idea.iteblog.com/key.php
2017.3版本更新后2已失效,使用1吧,或者自行搭建授权服务器(1上有教程)
idea 还可以申请edu邮箱获取linsence key,有邮箱的可以尝试一下(可以尝试去注册免费的edu邮箱进行申请) https://www.jetbrains.com/zh/student/
分类: idea
Wednesday, November 30, 2016
celery错误
使用celery发现如下错误,配置的一个虚拟环境中可以运行,但是root环境确不可以。通过卸载 redis-py,重新安装redis解决,感觉可能是其他插件的原因。目前没有重现,重现后再好好找找原因。错误记录如下:
[2016-11-30 10:47:49,779: CRITICAL/MainProcess] Unrecoverable error: TypeError("can_read() got an unexpected keyword argument 'timeout'",)
Traceback (most recent call last):
File "/anaconda/lib/python2.7/site-packages/celery/worker/worker.py", line 203, in start
self.blueprint.start(self)
File "/anaconda/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/anaconda/lib/python2.7/site-packages/celery/bootsteps.py", line 370, in start
return self.obj.start()
File "/anaconda/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 318, in start
blueprint.start(self)
File "/anaconda/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/anaconda/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 584, in start
c.loop(*c.loop_args())
File "/anaconda/lib/python2.7/site-packages/celery/worker/loops.py", line 88, in asynloop
next(loop)
File "/anaconda/lib/python2.7/site-packages/kombu/async/hub.py", line 345, in create_loop
cb(*cbargs)
File "/anaconda/lib/python2.7/site-packages/kombu/transport/redis.py", line 1038, in on_readable
self.cycle.on_readable(fileno)
File "/anaconda/lib/python2.7/site-packages/kombu/transport/redis.py", line 337, in on_readable
chan.handlers[type]()
File "/anaconda/lib/python2.7/site-packages/kombu/transport/redis.py", line 670, in _receive
while c.connection.can_read(timeout=0):
TypeError: can_read() got an unexpected keyword argument 'timeout'
[2016-11-30 10:47:49,779: CRITICAL/MainProcess] Unrecoverable error: TypeError("can_read() got an unexpected keyword argument 'timeout'",)
Traceback (most recent call last):
File "/anaconda/lib/python2.7/site-packages/celery/worker/worker.py", line 203, in start
self.blueprint.start(self)
File "/anaconda/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/anaconda/lib/python2.7/site-packages/celery/bootsteps.py", line 370, in start
return self.obj.start()
File "/anaconda/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 318, in start
blueprint.start(self)
File "/anaconda/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/anaconda/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 584, in start
c.loop(*c.loop_args())
File "/anaconda/lib/python2.7/site-packages/celery/worker/loops.py", line 88, in asynloop
next(loop)
File "/anaconda/lib/python2.7/site-packages/kombu/async/hub.py", line 345, in create_loop
cb(*cbargs)
File "/anaconda/lib/python2.7/site-packages/kombu/transport/redis.py", line 1038, in on_readable
self.cycle.on_readable(fileno)
File "/anaconda/lib/python2.7/site-packages/kombu/transport/redis.py", line 337, in on_readable
chan.handlers[type]()
File "/anaconda/lib/python2.7/site-packages/kombu/transport/redis.py", line 670, in _receive
while c.connection.can_read(timeout=0):
TypeError: can_read() got an unexpected keyword argument 'timeout'
Subscribe to:
Posts (Atom)