Friday, December 16, 2016

WINDOWS SUBSYSTEM使用中遇到的问题


  1. 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都会遇到
解决方法:
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
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

参见:https://github.com/Microsoft/BashOnWindows/issues/365

jetbrains 激活

http://jetbrains.tencent.click
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
2017.3版本更新后2已失效,使用1吧,或者自行搭建授权服务器(1上有教程)
idea 还可以申请edu邮箱获取linsence key,有邮箱的可以尝试一下(可以尝试去注册免费的edu邮箱进行申请) https://www.jetbrains.com/zh/student/
http://idea.imsxm.com/
分类: 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'

Sunday, November 27, 2016

conda virtualenv

以前玩深度学习一直是用的theano和keras,做为谷粉不能不试一下大热的TensorFlow。首先安装起来。

TensorFlow的安装指南非常详细,我是python的anaconda环境,所以直接先创建一个新环境,创建前先更新一下conda
conda update conda
conda update anaconda
看一下目前计算机上有哪些环境
conda info --env
目前只有root环境,所以新建一个专门为TensorFlow的环境,并将root中的包克隆过来
conda create --name tensorflow --clone root
激活使用环境
source activate tensorflow
退出环境
source deactivate

使用pip来安装
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl

然后我们可以使用jupyter notebook来启动,下面是两个最简单的示例。

网易云音乐ubuntu

sudo gdebi netease-cloud-music_1.0.0_amd64_ubuntu16.04.deb

huozhe
apt-get -f install

Wednesday, November 16, 2016

GibbsLDA++ 使用记录

之前在centos下编译成功了,但是现在用的是ubuntu 16.04报错了
错误如下:
make -C src/ -f Makefile all
make[1]: Entering directory '/media/fanyangfeng/windoc/lecom/lecomwork/auto_feedback/lda/GibbsLDA++-0.2/src'
g++ -c -o utils.o utils.cpp
utils.cpp: In static member function ‘static int utils::parse_args(int, char**, model*)’:
utils.cpp:69:28: error: ‘atof’ was not declared in this scope
      alpha = atof(argv[++i]);     
                            ^
utils.cpp:72:27: error: ‘atof’ was not declared in this scope
      beta = atof(argv[++i]);     
                           ^
utils.cpp:75:24: error: ‘atoi’ was not declared in this scope
      K = atoi(argv[++i]);     
                        ^
utils.cpp:78:29: error: ‘atoi’ was not declared in this scope
      niters = atoi(argv[++i]);     
                             ^
utils.cpp:81:31: error: ‘atoi’ was not declared in this scope
      savestep = atoi(argv[++i]);
                               ^
utils.cpp:84:29: error: ‘atoi’ was not declared in this scope
      twords = atoi(argv[++i]);
                             ^
utils.cpp: In static member function ‘static int utils::read_and_parse(std::__cxx11::string, model*)’:
utils.cpp:270:41: error: ‘atof’ was not declared in this scope
      pmodel->alpha = atof(optval.c_str());
                                         ^
utils.cpp:273:40: error: ‘atof’ was not declared in this scope
      pmodel->beta = atof(optval.c_str());
                                        ^
utils.cpp:276:37: error: ‘atoi’ was not declared in this scope
      pmodel->K = atoi(optval.c_str());
                                     ^
utils.cpp:279:37: error: ‘atoi’ was not declared in this scope
      pmodel->M = atoi(optval.c_str());
                                     ^
utils.cpp:282:37: error: ‘atoi’ was not declared in this scope
      pmodel->V = atoi(optval.c_str());
                                     ^
utils.cpp:285:41: error: ‘atoi’ was not declared in this scope
      pmodel->liter = atoi(optval.c_str());
                                         ^
Makefile:17: recipe for target 'utils.o' failed
make[1]: *** [utils.o] Error 1
make[1]: Leaving directory '/media/fanyangfeng/windoc/lecom/lecomwork/auto_feedback/lda/GibbsLDA++-0.2/src'
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2


在http://blog.sciencenet.cn/blog-425672-654209.html找到答案,解决办法
解决方法:
1). 在src/utill.cpp 文件头加入:
#include<stdio.h> #include<stdlib.h>
2). 在src/utill.h 文件头加入:
#include<stdlib.h>
3). 在src/lda.cp 文件头加入:
#include<stdio.h>
4). 重新make

Thursday, November 3, 2016

mysql导入数据,制定特定列的方式

I am running this MySQL command:
LOAD DATA LOCAL INFILE 'books.csv'
INTO TABLE BOOK (Book_id, @dummy, Title, Publisher_name, @dummy, @dummy)
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
I am getting an error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual 
that corresponds to your MySQL server version for the right syntax to use near 
'FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n' IGNORE 1 LINES' at line 3
What am I doing wrong here?
shareimprove this question

2 Answers

http://dev.mysql.com/doc/refman/5.6/en/load-data.html shows the syntax. The clause naming columns goes after the IGNORE clause.
LOAD DATA LOCAL INFILE 'books.csv'
  INTO TABLE BOOK 
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(Book_id, @dummy, Title, Publisher_name, @dummy, @dummy);
shareimprove this answer