先说一点需要注意的:不要编辑960.css文件,如果你修改了它,那么你今后将无法更新这个框架。 继续阅读
文章分类
-
最近更新
2012 五月 一 二 三 四 五 六 日 « 九 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
960 Grid System(简称960 GS)是一种基于网格的布局框架,使用它可以极大地简化页面的布局工作。在Web工程里引入960.css,你就可以安心使用其定义的各个class了。除了这个必须引入的文件,960 GS提供的下载包中还有两个css文件值得一提:reset.css和text.css。这两个文件的主要作用是为了消除浏览器间显示差异准备的,前者消除了html标签在各浏览器间的差异,而后者则主要针对的是字体。 继续阅读
Rsync的命令格式可以为以下六种:
rsync [OPTION]… SRC DEST
rsync [OPTION]… SRC [USER@]HOST:DEST
rsync [OPTION]… [USER@]HOST:SRC DEST
rsync [OPTION]… [USER@]HOST::SRC DEST
rsync [OPTION]… SRC [USER@]HOST::DEST
rsync [OPTION]… rsync://[USER@]HOST[:PORT]/SRC [DEST] 继续阅读
将一个wordpress站由worklog.ctdz8.com移到worklog.ctdz.com.cn:
1、倒出数据库
mysqldump –uusername –ppassword db_worklog > worklog.sql
2、替换数据库中的域名
sed ‘s/worklog.ctdz8.com/worklog.ctdz.com.cn/g’ worklog.sql >worklog1.sql
3、将worklog1.sql和wordpress目录拷到新地点
4、新机器恢复数据库
mysql –uroot –p
CREATE DATABASE IF NOT EXISTS db_worklog;
GRANT ALL PRIVILEGES ON db_worklog.* TO “username”@”%” IDENTIFIED BY “password”;
mysql –uusername –ppassword db_worklog <worklog1.sql
OpenERP 6.0.2 Web客户端在进入某些菜单功能时会出现错误,跟踪错误信息如下:
<type ‘exceptions.UnicodeEncodeError’>: ‘ascii’ codec can’t encode character u’\u5e74′ in position 2: ordinal not in range(128)
args = (‘ascii’, u’%Y\u5e74%m\u6708%d\u65e5 %H\u65f6%M\u5206%S\u79d2′, 2, 3, ‘ordinal not in range(128)’)
encoding = ‘ascii’
end = 3
message = ”
object = u’%Y\u5e74%m\u6708%d\u65e5 %H\u65f6%M\u5206%S\u79d2′
reason = ‘ordinal not in range(128)’
start = 2
估计是某些程序没有使用正确的encoding来解码中文日期格式造成的,如果到程序中修改encoding,工作量比较大,可以考虑修改一下日期显示方式,去掉日期里面的中文字符来解决这个问题:
进入系统管理-翻译-语言,选择中文简体。
将日期格式从”%Y年m%月d%日”改为”%Y-m%-d%”
将时间格式从”%h时%m分%s秒”改为”%h:%m:%s”
注意要使用扩展界面才会有“系统管理-翻译-语言”菜单。
备份:
pg_dump –h localhost –U username –b db_name > dump_file
恢复:
dropdb –h localhost –U username db_name
createdb –h localhost –U username db_name
psql –h localhost –U username –d db_name < dump_file
sudo su – postgres
createuser –createdb –no-createrole –pwprompt openerp
– Shall the new role be a superuser? (y/n) y
– password: *****
sudo apt-get install python-lxml sudo apt-get install python-mako sudo apt-get install python-egenix-mxdatetime sudo apt-get install python-dateutil sudo apt-get install python-psycopg2 sudo apt-get install python-pychart sudo apt-get install python-pydot sudo apt-get install python-tz sudo apt-get install python-reportlab sudo apt-get install python-yaml sudo apt-get install python-vobject
wget http://www.openerp.com/download/stable/source/openerp-server-6.0.1.tar.gz tar xvfz openerp-server-6.0.1.tar.gz
#!/bin/sh cd /userdir/openerp/openerp-server-6.0.1/bin exec /usr/bin/python ./openerp-server.py $@
# /etc/openerp-server.conf(5) - configuration file for openerp-server(1) [options] # Enable the debugging mode (default False). verbose = False debug_mode = False # The file where the server pid will be stored (default False). #pidfile = /var/run/openerp.pid # The file where the server log will be stored (default False). logfile = /var/log/openerp-server.log # The unix account on behalf openerp is running. process_user = zg # The IP address on which the server will bind. # If empty, it will bind on all interfaces (default empty). interface = # The TCP port on which the server will listen (default 8069). #port = 8070 # Enable debug mode (default False). debug_mode = False # Launch server over https instead of http (default False). secure = False # Specify the SMTP server for sending email (default localhost). smtp_server = localhost # Specify the SMTP user for sending email (default False). smtp_user = False # Specify the SMTP password for sending email (default False). smtp_password = False # Specify the database name. db_name = # Specify the database user name (default None). db_user = openerp # Specify the database password for db_user (default None). db_password = ****** # Specify the database host (default localhost). db_host = localhost # Specify the database port (default None). db_port = 5432 # Specify the price accuracy. #price_accuracy =
#!/bin/sh # # Open ERP server 启动脚本,by zhuge 2011-3-25 # PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin DAEMON=/home/zg/openerp/openerp-server CONFIGFILE=/home/zg/openerp/openerp-server.cfg NAME=openerp-server DESC=openerp-server USER=zg test -x ${DAEMON} || exit 0 set -e case "${1}" in start) echo -n "Starting ${DESC}: " start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ --chuid ${USER} --background --make-pidfile \ --exec ${DAEMON} -- --config=${CONFIGFILE} echo "${NAME}." ;; stop) echo -n "Stopping ${DESC}: " start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ --oknodo echo "${NAME}." ;; restart|force-reload) echo -n "Restarting ${DESC}: " start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ --oknodo sleep 1 start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ --chuid ${USER} --background --make-pidfile \ --exec ${DAEMON} -- --config=${CONFIGFILE} echo "${NAME}." ;; *) N=/etc/init.d/${NAME} echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0
sudo apt-get install python-cherrypy3
sudo apt-get install python-formencode
sudo apt-get install python-pybabel
sudo apt-get install python-mako
sudo apt-get install python-simplejson
sudo apt-get install python-pyparsing
wget http://www.openerp.com/download/stable/source/openerp-web-6.0.1.tar.gz
tar xvfz openerp-web-6.0.1.tar.gz
#!/bin/sh cd /userdir/openerp/openerp-web-6.0.1 exec /usr/bin/python ./openerp-web.py $@
配置文件的模板在/userdir/openerp/openerp-web-6.0.1/doc/openerp-web.cfg
(openerp 5 在/userdir/openerp/openerp-web-5.0.16/config/openerp-web.cfg)
#!/bin/sh # # Open ERP web 启动脚本,by zhuge 2011-3-25 # PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin DAEMON=/home/zg/openerp/openerp-web CONFIGFILE=/home/zg/openerp/openerp-web.cfg NAME=openerp-web DESC=openerp-web USER=zg test -x ${DAEMON} || exit 0 set -e case "${1}" in start) echo -n "Starting ${DESC}: " start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ --chuid ${USER} --background --make-pidfile \ --exec ${DAEMON} -- --config=${CONFIGFILE} echo "${NAME}." ;; stop) echo -n "Stopping ${DESC}: " start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ --oknodo echo "${NAME}." ;; restart|force-reload) echo -n "Restarting ${DESC}: " start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ --oknodo sleep 2 start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ --chuid ${USER} --background --make-pidfile \ --exec ${DAEMON} -- --config=${CONFIGFILE} echo "${NAME}." ;; *) N=/etc/init.d/${NAME} echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0
1、程序排错时的注意点: 先处理第一个错误、改正后要重新编译
2、典型问题: 大小写、缺分号、没有生成hex、没有将源文件加入project
3、比较难发现的问题:变量溢出、#define中的错误、逻辑错误
4、培养良好的程序风格:缩进、注释、命名
5、C51数据类型:字节数、取值范围、符号;新增:bit、sbit、sfr、sfr16
6、MCS-51单片机的存储区域与存储模式
#include <reg51.h> /* * 延时 * t: 延时时间,单位ms */ void Delay(unsigned int t) { unsigned char i; while(t!=0) { t--; for(i=120;i>0;i--); } } sbit P1_0=0x90; // 定义P1口的P1.0引脚 sbit P1_1=P1^1; // 定义P1口的P1.1引脚 sbit P1_2=0x90^2; // 定义P1口的P1.2引脚 void main( void ) { unsigned int i; // 定义无符号整型变量i,用于循环延时 P1=0x00; // 关闭接在P1口的所有发光二极管 do { P1_0 = ~P1_0; // 将sbit型变量P1_0取反 P1_1 = ~P1_1; // 将sbit型变量P1_1取反 P1_2 = ~P1_2; // 将sbit型变量P1_2取反 Delay(1000); // 延时1秒 }while(1); }
既然Delay()经常用到,能不能象printf()一样?
程序分模块有什么好处?
不一定完全照书上,建议参考我们前几次课优化过的程序:
#include <reg51.h> /* * 延时 * t: 延时时间,单位ms */ void Delay(unsigned int t) { unsigned char i; while(t!=0) { t--; for(i=120;i>0;i--); } } void main( void ) { unsigned char code LEDMAP[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; unsigned char i; for (;;) { for (i=0;i<8;i++) { P1=LEDMAP[i]; Delay(500); /* 延时500ms */ } } }
要点:
1、为不同的花样建立数组(2-16进制转换)
2、如何优化程序?
导入: 数组、指针、函数
教材P60
运算符与表达式
运算符要点:优先级、=和==、 &和&&
指针的本质
数组与指针的关系
字符串与指针的关系
C51关于指针类型的特殊点
…
在wordpress后台,设置->撰写中,有一个更新服务,加入:http://ping.baidu.com/ping/RPC2
这样,当文章更新之后,就会主动通知百度
WordPress的存档页和日历页等,对百度来说是多余的,因为这项页面内容在其他网页中都是有的,Google能很好的识别出来,不收录他们,但是百度会收录,而且会认为你的网页内容重复。
解决方案是在robots.txt中禁止这两类页面,示例如下:
User-agent: *
Disallow: /wp-*
Allow: /wp-content/uploads/
Allow: /wp-content/downloads/
Disallow: /*.php$
Disallow: /*.inc$
Disallow: /*.js$
Disallow: /*.css$
Disallow: /?
Disallow: /feed
Disallow: /*/*/feed
Disallow: /trackback
Disallow: /*/*/trackback
Disallow: /index.php?
Disallow: /index.php/
Disallow: /date/
Disallow: /page/
Disallow: /?p= 单独文章页面
Disallow: /?cat= 文章分类页面
Disallow: /?tag= 文章标签页面
Disallow: /?m= 文章按月归档
Disallow: /?r= 文章评论链接跳转地址
Disallow: /?s= 文章站内搜索结果页面
Disallow: /?paged= 固定页面
Disallow: /?feed= 博客订阅feed
Disallow: /?* 其他动态页面
All in one seo插件是对google优化有效果,据说会影响百度收录。
在wordpress后台直接搜索安装插件baidu-sitemap-generator
点击设置栏目下的Baidu-Sitemap选项进入插件设置页面。
生成的sitemap文件的文件名和格式分别是sitemap_baidu.xml、sitemap.html
在首页合适的位置加上这两个文件的链接,以方便百度蜘蛛访问。
也可放在robots.txt中:
Sitemap: http://www.visualay.com/sitemap_baidu.xml
Sitemap: http://www.visualay.com/sitemap.html