python 邮件发送

python 2.7代码如下:

#coding: utf-8
import smtplib
from email.mime.text import MIMEText

#connect smtp server
msg = MIMEText(‘Hello’,’plain’,’utf-8′)
msg[‘Subject’] = ‘ Load data sucess!’
#msg[‘Date’] = formatdate(localtime=True)
smtp = smtplib.SMTP()
smtp.connect(‘proxy-in.xxx.com’)
smtp.sendmail(‘bidev@xxx.com’, ‘swer@xxx.com’, msg.as_string())

 

python 2.4.3

#coding: utf-8
import smtplib
from email.MIMEText import MIMEText

#connect smtp server
msg = MIMEText(‘Hello’,’plain’,’utf-8′)
msg[‘Subject’] = ‘ Load data sucess!’
smtp = smtplib.SMTP()
smtp.connect(‘proxy-in.xxx.com’)
smtp.sendmail(‘bidev@xxx.com’, ‘hsdf@xxx.com’, msg.as_string())

CXXNET安装

环境:ubuntu 14.04,  cuda 6.5

先安装cuda-toolkit, cuda-cublas, cudart, cuda-curand这四个安装包

cuda_6.5.14_linux_64.run

cuda-cublas-6-5_6.5-14_amd64.deb
cuda-cudart-6-5_6.5-14_amd64.deb
cuda-curand-6-5_6.5-14_amd64.deb

下载路径:http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/

安装 OpenCV

sudo apt-get install libopencv-2.4

 

配置环境变量

vi ~/.bashrc

export CUDA_HOME=/usr/local/cuda-6.5
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:/usr/local/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=/usr/local/cuda/include

 

下载一份cxxnet

git clone https://github.com/dmlc/cxxnet.git

切换至目录 cd cxxnet

拷贝一份配置到当前目录 cp make/config.mk .

修改 vi config.mk

USE_CUDA = 1

USE_BLAS = blas

USE_DIST_PS = 1
USE_OPENMP_ITER = 1

编辑 vi  Makefile, 修改如下:

CFLAGS += -g -O3 -I./mshadow/  -fPIC $(MSHADOW_CFLAGS) -fopenmp -I/usr/local/cuda/include
LDFLAGS = -pthread $(MSHADOW_LDFLAGS) -L/usr/local/cuda/lib64

 

最后编译文件

./build.sh

 

 

unable to correct problems you have held broken packages

OS:  Ubuntu 14.04

When installing a ubuntu desktop KDE,  some error  like “unable to correct problems you have held broken packages” happen.  So I finally found the problm is the package python3-software-properties is too new and can’t be compatible with the kde package. The soluation is follling:

sudo apt-get remove python3-software-properties

sudo apt-get install python3-software-properties=0.92.36

luarocks安装–Failed loading manifest

使用luarocks安装lunit,出现下面报错:

jerry@ubuntu:~$ sudo luarocks install lunit
Warning: Failed searching manifest: Failed fetching manifest for https://raw.githubusercontent.com/torc h/rocks/master – Failed downloading https://raw.githubusercontent.com/torch/rocks/master/manifest
Warning: Failed searching manifest: Failed fetching manifest for https://raw.githubusercontent.com/rock s-moonscript-org/moonrocks-mirror/master – Failed downloading https://raw.githubusercontent.com/rocks-m oonscript-org/moonrocks-mirror/master/manifest

Error: No results matching query were found.

经查发现https://raw.githubusercontent.com/torch/rocks/master/manifest这个地址无法连接。只好切换另一个服务器了

方法1:

sudo luarocks install –verbose –only-server=http://rocks.moonscript.org lunit

方法2:

jerry@ubuntu:~$ mkdir ~/.cache/luarocks/https___rocks.moonscript.org

jerry@ubuntu:~$ sudo wget https://rocks.moonscript.org/manifest-5.1 -O ~/.cache/luarocks/https___rocks.moonscript.org/manifest-5.1

 

 

查看端口是否占用

环境 :CentOS

[root@sandbox ~]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 1118 root 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1255 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1256 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1257 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1258 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1259 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1260 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1261 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)
httpd 1262 apache 4u IPv6 9178 0t0 TCP *:http (LISTEN)

Ubuntu升级慎重

环境:ubuntu 12.04, ubuntu 14.04, wordpress 4.0, opencart 1.5, postgresql 9.1, mysql 5

昨天升级ubuntu系统至14.04版本后,发现之前安装的wordpress和opencart全线瘫痪。(冒汗不止)。这两个主页都是空白的,无任务报错信息。只能到网上狂搜一把。解决方案如下

wordpress:

“无法选择数据库”(postgresql),试过各种方法,最后只能把wordpress降版本至3.4.2

wget https://cn.wordpress.org/wordpress-3.4.2-zh_CN.tar.gz

重新布置到/var/www目录下。 (注意ubuntu 14.04的apache2的DocumentRoot与之前不同位置。

sudo vi /etc/apache2/sites-enabled/000-default.conf

将DocumentRoot /var/www/html修改为DocumentRoot /var/www)

还是一个问题是wordpress默认主题需要更改,否则也是只能看到空白页面

 

opencart:

增加一行到index.php显示出错日志

<?php
ini_set(‘display_errors’, ‘on’);
?>

Fatal error: Call to undefined function mcrypt_create_iv() is that mcrypt

重新安装mcrypt和php5-mcrypt

sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt

php -m | grep mcrypt

加载模块

sudo php5enmod mcrypt

 

今天是几乎花费半天的时间来处理这两个应用的问题, 网上的解决方法也是只能给个思路。只能自己深入地了解问题才能定位并解决。还有一点,升级系统切记要慎重!