导航

2013年6月12日

摘要: Python file vs open:'file' is a type, like an int or a list. 'open' is a function for opening files, and will return a 'file' object.Also, python 3.0 will have file() removed.1.open使用open打开文件后一定要记得调用文件对象的close()方法。比如可以用try/finally语句来确保最后能关闭文件。f=open('f.txt','w' 阅读全文

posted @ 2013-06-12 22:19 疯狂原始人 阅读(573) 评论(0) 推荐(0)

摘要: https://mirrors.fedoraproject.org/publiclist/http://mirror.centos.org/centos/6.3/os/i386/http://rpmfind.netrpm listhttp://pkgs.org/http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmrpm -Uvh epel-release*rpmwine 安装X针对错误checking for X... noconfigure: error: X development files not 阅读全文

posted @ 2013-06-12 22:18 疯狂原始人 阅读(182) 评论(0) 推荐(0)

摘要: 比较两个字符串是否相等的办法是:if [ "$test"x = "test"x ]; then这里的关键有几点:1 使用单个等号2 注意到等号两边各有一个空格:这是unix shell的要求 3 注意到"$test"x最后的x,这是特意安排的,因为当$test为空的时候,上面的表达式就变成了x = testx,显然是不相等的。而如果没有这个x,表达式就会报错:[: =: unary operator expected 二元比较操作符,比较变量或者比较数字.注意数字与字符串的区别. 整数比较 -eq 等于,如:if [ "$a 阅读全文

posted @ 2013-06-12 22:17 疯狂原始人 阅读(288) 评论(0) 推荐(0)

摘要: Debian安装flashplaer: 1.修改/etc/apt/sources.listdeb http://ftp.de.debian.org/debian squeeze main contribapt-get updateapt-get install flashplugin-nonfree or aptitude reinstall flashplugin-nonfreeCentos安装flashplaer: 1.Install Adobe YUM Repository RPM package## Adobe Repository 32-bit x86 ##rpm -ivh ht.. 阅读全文

posted @ 2013-06-12 22:16 疯狂原始人 阅读(253) 评论(0) 推荐(0)

摘要: Debian开机启动VNC:启动VNC并设置:startjwm & firefox --display=:1### BEGIN INIT INFO# Provides: vncserver# Required-Start: $remote_fs $syslog# Required-Stop: $remote_fs $syslog# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: Start daemon at boot time# Description: Enable service provided b 阅读全文

posted @ 2013-06-12 22:15 疯狂原始人 阅读(1916) 评论(0) 推荐(0)

摘要: 通过启动脚本来创建一个服务,使用chkconfig来指定启动服务级别、chkconfig 命令用来更新和查询不同运行级上的系统服务。 语法为: chkconfig --list [name] chkconfig --add name chkconfig --del name chkconfig [--level levels] name chkconfig [--level levels] name在/etc/init.d/文件夹下新建服务[root@atl ~]# vim /etc/init.d/vagexrun[root@atl ~]# chmod +x /etc/init.d/vage. 阅读全文

posted @ 2013-06-12 22:12 疯狂原始人 阅读(237) 评论(0) 推荐(0)

摘要: Mysql默认是不可以通过远程机器访问的,通过下面的配置可以开启远程访问.我的Mysql环境是centos+mysql51.修改/etc/my.conf,修改bind-address,指定为本机实际IP地址,你的my.con修改完大概是如下的样子[mysqld] # # * Basic Settings # default-character-set=utf8 default-storage-engine=INNODB bind-address = 192.168.1.107 user = mysql pid-file = /var/r... 阅读全文

posted @ 2013-06-12 22:05 疯狂原始人 阅读(250) 评论(0) 推荐(0)

摘要: 1 源文件编码 在文件头部使用coding声明。告诉python 解释器该代码文件所使用的字符集。 #/usr/bin/python #coding: utf82 内部编码 代码文件中的字符串,经过decode以后,被转换为统一的unicode格式的内部数据,类似于u'*'。unicode数据可以使用encode函数,再自由转换为其他格式的数据,相当于一个统一的平台。 直接输入unicode数据 >>> u'你好' u'\u4f60\u597d' 将unicode数据转换为 gb2312 格式 >>> u 阅读全文

posted @ 2013-06-12 22:04 疯狂原始人 阅读(591) 评论(0) 推荐(0)

摘要: urllib和urllib2都是接受URL请求的相关模块,但是提供了不同的功能。两个最显著的不同如下:urllib2 can accept a Request object to set the headers for a URL request, urllib accepts only a URL. That means, you cannot masquerade your User Agent string etc.urllib2可以接受一个Request类的实例来设置URL请求的headers,urllib仅可以接受URL。这意味着,你不可以伪装你的User Agent字符串等。url 阅读全文

posted @ 2013-06-12 22:01 疯狂原始人 阅读(305) 评论(0) 推荐(0)

摘要: 1. replace Figure with Fig.\renewcommand{\figurename}{Fig.} 2.Latex设置字体大小命令由小到大依次为:\tiny\scriptsize\footnotesize\small\normalsize\large\Large\LARGE\huge\Huge使用方法,例如:\large{这是大号字体}加粗:\textbf{文字}数学模式下用\usepackage{bm}$\bm{ a }$ 下划线:用 \underline{ This is an underline text } 就可以.斜体:用 \emph{文字}跟 \emph{} 命 阅读全文

posted @ 2013-06-12 21:50 疯狂原始人 阅读(310) 评论(0) 推荐(0)