android: jenkins 配置

  1.  设置jenkins时区
  2. 设置workspace 路径--参考链接[1]
  3. 设置邮件通知模版 —–参考链接[2]
  4.  邮件发送失败  ----参考链接[3]
    1. 管理员账号和默认发送账号不一致

 

 

 

 

参考:

[1]http://www.cnblogs.com/itech/p/5192162.html

[2] http://www.360logica.com/blog/2016/02/email-notification-in-jenkins.html

[3]http://www.cnblogs.com/asia90li/p/6418418.html

scrapy : builtins.AttributeError: ‘list’ object has no attribute ‘dont_filter’

1.

 

This appears to be a bug in Scrapy. The current version doesn’t seem to accept lists returned from make_requests_from_url(). I was able to modify the Scrapy code in the following way to work around the issue.

In the file Scrapy-0.16.5-py2.7.egg/scrapy/spider.py

Change:

def start_requests(self):
    for url in self.start_urls:
        yield self.make_requests_from_url(url)

To:

def start_requests(self):
    for url in self.start_urls:
        requests = self.make_requests_from_url(url)
        if type(requests) is list:
            for request in requests:
                yield request
        else:
            yield requests

I expect that the official Scrapy people will fix this eventually.

 

 

参考:

[1]http://stackoverflow.com/questions/13476688/scrapy-unhandled-exception

web : html div 保存为png ,使用html2canvas

 

 

$("#btn_screen").on("click", function () {               
                html2canvas($("#tbl_exception"), {
                    height: $("#tbl_exception").outerHeight() + 20,
                    onrendered: function (canvas) {
                        var url = canvas.toDataURL();
                        //以下代码为下载此图片功能
                        var triggerDownload = $("<a>").attr("href", url).attr("download", getNowFormatDate()+"异常信息.png").appendTo("body");
                        triggerDownload[0].click();
                        triggerDownload.remove();
                    }
                });
            });

参考:

[1]:http://www.cnblogs.com/yanweidie/p/5203943.html  [重要有用]

[2]http://www.cnblogs.com/wzh2010/archive/2012/09/02/2667639.html [生成报表]

[3]https://75team.com/post/convert-code-to-image-via-html2canvas.html

[4]http://web.jobbole.com/83715/ [另一种思路,待看]

linux : VMware 虚拟机中添加新硬盘的方法 , fdisk 用法

1.

三、虚拟机中Linux对于虚拟的磁盘的挂载

1、使用“fdisk -l”的命令查看当前系统的分区(如果刚才设置VMware–setting的时候运行了系统,则会出现下图情况:没有识别到新的磁盘即sdb),解决办法,重启虚拟机:shutdown -r now

 2、如果执行第一步的时候是关闭虚拟机中的系统的,则使用“fdisk -l 命令的时候则会出现新的磁盘sdb(不过提示未分区)

 

 

3、对新建的磁盘进行分区及格式化的工作:

输入 fdisk  /dev/sdb

终端会提示:Command (m for help):

 

 

4、在上一步骤的基础上输入:m  则会出现下列的提示:

 

 

5、然后根据提示输入:n

会出现下面的提示,依次输入p 和 1 即可

接着便会提示卷的起始地址和结束地址,都保持默认按回车的即可(意思是只分一个区)

 

 

6、输入“w”保存并推出

 

7、再次使用 “fdisk -l ”这个命令来查看会发现出现了/dev/sdb1(说明已经完成了分区工作)

 

 8、对新建的分区进行格式化:格式化成ext3的文件系统即可

 

 

9、下面便是对于分好区的/dev/sdb1 这一个分区进行挂载及访问

9、1手动挂载:使用mount /dev/sdb1  /要挂载的目录(自己自定义)

访问时:cd  /挂载的目录   即可对其进行存储和访问

 

9、2自动挂载:修改/etc/fstab即可

使用vim /etc/fstab打开配置的文件,然后将下面的一行文字添加即可

/dev/sdb1       /media(这个挂载的目录你自己设置即可)      ext3    defaults            1

参考:

[1]http://blog.csdn.net/hanpengyu/article/details/7475645

[2] http://www.cnblogs.com/yiru/archive/2012/11/15/2770968.html

python : UnicodeEncodeError: ‘latin-1’ codec can’t encode characters in position 0-1: ordinal not in range(256)

  1.  在使用 sqlalchemy ,更新中文字符的出现编码问题
create_engine('mysql+mysqldb:///mydb?charset=utf8')

Setting use_unicode alone won’t tell sqlalchemy which charset to use.

 

参考:

[1]http://stackoverflow.com/questions/10819192/sqlalchemy-result-for-utf-8-column-is-of-type-str-why  [有效]

[2]http://firefish.blog.51cto.com/298258/112794/

python : SQLAlchemy 使用 orm框架 [TODO]

 

  1. sqlalchemy 自动创建表  –链接6

  2.  count 使用
    1. count = session.query(User).filter_by(boss_id='0900640').count();
      print count

参考:

[1]http://www.jianshu.com/p/0d234e14b5d3

[2]http://www.jianshu.com/p/152685de2533

[3] http://stackoverflow.com/questions/35918605/how-to-delete-a-table-in-sqlalchemy [table drop]

[4] http://www.jianshu.com/p/8d085e2f2657  [query 使用]

[5]http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/0014021031294178f993c85204e4d1b81ab032070641ce5000

[6]http://www.wanghd.com/%E5%90%8E%E7%AB%AF/2013/03/05/sqlalchemy-zi-dong-chuang-jian-biao.html

mac : mysql 启动

 

MacBook-Pro:~ saiwei$ mysql.server status
ERROR! MySQL is not running, but PID file exists
You have new mail in /var/mail/saiwei
MacBook-Pro:~ saiwei$ mysql.server start
Starting MySQL
SUCCESS!

python : send ssl mail , html mail

备注:邮件标题一样的只能,如果用来发脚本邮件,主题记得每次变

  1. 发送普通mail
  2. 发送ssl mail
  3. 发送 html mail
#!/usr/bin/env python

import sys, smtplib, socket
from getpass import getpass

if len(sys.argv) &lt;4:
 print "Syntax %s server fromaddr toaddr [toaddr...]" % sys.argv[0]
 sys.exit(255)

server = sys.argv[1]
fromaddr = sys.argv[2]
toaddrs = sys.argv[3:]

message = """To: %s
From: %s
Subject: Test Message from smtp465.py

Hello,

 This is a test file to try smtplib.

-s
""" % (', '.join(toaddrs), fromaddr)

sys.stdout.write("Enter username: ")
username= sys.stdin.readline().strip()
password= getpass("Enter passcode: ")

try:
 s=smtplib.SMTP_SSL(server,465)
 s.set_debuglevel(1)
 s.ehlo()
 try:
 s.login(username,password)
 except smtplib.SMTPException, e:
 print "Authentication failed:", e
 sys.exit(1)
 s.sendmail(fromaddr, toaddrs, message)
except (socket.gaierror, socket.error, socket.herror, smtplib.SMTPException), 
 e:
 print " *** your message may not have been sent! "
 print e
 sys.exit(2)
else:
 print "Message successfully sent to %d recipient(s) " %len(toaddrs)

2.

python发邮件要抄送或者暗送,只需要设置message的CC和BCC对应的值即可,如下代码示例:

toaddr = 'buffy@outofmemory.cn'
cc = ['alexander@sunydale.k12.ca.us','willow@outofmemory.cn']
bcc = ['chairman@slayerscouncil.uk']
fromaddr = 'giles@outofmemory.cn'
message_subject = "disturbance in sector 7"
message_text = "Three are dead in an attack in the sewers below sector 7."
message = "From: %s\r\n" % fromaddr
        + "To: %s\r\n" % toaddr
        + "CC: %s\r\n" % ",".join(cc)
        + "BCC: %s\r\n" % ",".join(bcc)
        + "Subject: %s\r\n" % message_subject
        + "\r\n" 
        + message_text
toaddrs = [toaddr] + cc + bcc
server = smtplib.SMTP('smtp.outofmemory.cn')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, message)
server.quit()

 

参考:

[1]:http://www.shisaihua.com/python-smtplib-sending-mail-on-old-ssl-port-465/   [ssl 这个有用]

[2]http://www.runoob.com/python/python-email.html   [html 邮件]

[3]http://blog.csdn.net/jinguangliu/article/details/45127547 [html 邮件]

[4]https://wizardforcel.gitbooks.io/liaoxuefeng/content/py2/80.html  [待看]