上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
摘要: 1.先创建一个数据库备份目录:mkdirbackupcdbackupmkdirmysqlbackupcdmysqlbackup2.创建备份脚本vimysqlautobackup3.编写脚本:filename=`date+%Y%m%d`/mysql的bin目录/mysqldump--opt数据库名-... 阅读全文
posted @ 2013-03-04 00:31 rorshach 阅读(144) 评论(0) 推荐(0) 编辑
摘要: C语言函数指针:#includeintsum(inta,intb){returna+b;}intmain(){int(*p)(int,int);p=sum;printf("%d",p(1,34));return0;}C语言指针函数:#includechar*fun(char*s1,char*s2)... 阅读全文
posted @ 2013-02-21 20:56 rorshach 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 常量:intmain(){intconsta=100;a=10000;//错误,不能改变值//可以通过指针改变int*p=&a;*p=1000;//改变了a的值}常量指针:保护指针指向空间的值不能变.#includeintmain(){inta=100;intb=50;constint*p=&a;... 阅读全文
posted @ 2013-02-15 16:06 rorshach 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 指针与一维数组:指针存储的是变量的地址.示例程序:#includevoidmain(){intarr[]={12,15,16};int*p=arr;p++;printf("%d",*p);}示例程序:#includevoidmain(){intarr[]={12,15,16};int*p=arr;... 阅读全文
posted @ 2013-02-15 14:55 rorshach 阅读(101) 评论(0) 推荐(0) 编辑
摘要: struct定义:struct[名称]{…..};初始化:structperson{intid;char*name;};方式一:structpersonp1={100,"c"};方式二:structpersonp1;p1.id=100;对于普通的struct,使用.运算符赋值或取值,对于指针,使用... 阅读全文
posted @ 2013-02-14 15:12 rorshach 阅读(146) 评论(0) 推荐(0) 编辑
摘要: define定义常量:#defineM25定义表达式:#defineM(a,b)((a)>(b)?(a):(b))示例程序:#include#defineMAX(a,b)((a)>(b)?(a):(b))voidmain(){intc=MAX(5+8,8);printf("c=%d",c);}存储... 阅读全文
posted @ 2013-02-13 17:36 rorshach 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 一.基本类型:1.数值类型:A.整型:默认为有符号整型(signed),无符号整型为unsigneda.短整型:shortb.整型:intc.长整型:longB.浮点型:a.单精度:floatb.双精度:double2.字符类型二.构造类型:1.数组2.结构体:struct3.共用体:union4... 阅读全文
posted @ 2013-02-13 16:18 rorshach 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 不重启关闭selinux:setenforce0关闭防火墙:serviceiptablesstop 阅读全文
posted @ 2013-01-06 12:17 rorshach 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 名:life404组织:life404.cn注册码:NAVN-2QJ2-YZA9-46N6---------------------------------------------下载地址:官方简体中文版 阅读全文
posted @ 2012-12-28 22:21 rorshach 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 一.查看系统打开文件数限制ulimit-n二.调整系统限制vi/etc/security/limits.conf文件最后加上*softnofile51200*hardnofile51200三.修改php-fpm限制8g的子进程调为300,4g的为100编辑php-fpm.conf将max_chil... 阅读全文
posted @ 2012-12-28 10:59 rorshach 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 一.更新最快的源yum-yinstallyum-fastestmirroryum-yupdate添加源,在/etc/yum.repo.d目录(centos6.*为/etc/yum.repos.d目录)下创建一个文件alt.ru.repo,添加如下内容:[CentALT]name=CentALTPa... 阅读全文
posted @ 2012-12-28 10:52 rorshach 阅读(110) 评论(0) 推荐(0) 编辑
摘要: :1,$d删除全部内容 阅读全文
posted @ 2012-12-15 17:05 rorshach 阅读(139) 评论(0) 推荐(0) 编辑
摘要: //声明结构体structpoint{intx,y;}structpointmake(intx,inty);voidmain(){structpointpt=make(1,2);printf("%d%d",pt.x,pt.y);}structpointmake(intx,iny){structpo... 阅读全文
posted @ 2012-12-10 23:46 rorshach 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 定义结构方法一:structtemp{intx;inty;};voidmain(){structtempt;t.x=100;t.y=10;printf("%d",t.x);}定义方法二:typedefstruct{intx;inty;}temp;voidmain(){tempt;t.x=100;t... 阅读全文
posted @ 2012-12-10 23:38 rorshach 阅读(117) 评论(0) 推荐(0) 编辑
摘要: importthreadingimporttimeclassTest(threading.Thread):#继承threading.Threaddef__init___(self):super(Test,self).__init__()defrun(self):#设置线程方法threadname=... 阅读全文
posted @ 2012-11-25 17:00 rorshach 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 将数据以文件的形式保存importshelvedefcreate():try:db=shelve.open('db.dat','c')db['name']='jam'db['home']='ar'finally:db.close()defload():db=shelve.open('db.dat'... 阅读全文
posted @ 2012-11-25 16:13 rorshach 阅读(114) 评论(0) 推荐(0) 编辑
摘要: #-*-coding:gbk-*-importoscur_path=os.getcwd()lists=os.listdir(cur_path)forfinlists:iff!='ren.py':printcur_pathcur_file=cur_path+'\\'+fnew_file=cur_fi... 阅读全文
posted @ 2012-09-25 16:08 rorshach 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 一.centos5.5服务器基本1.使用su -切换到root目录下2.查看硬盘空间大小:df -lh3.安装软件(yum): yum install softname4.tar安装: a.下载软件到当前目录:wget http://www.domain.com/soft.tar.gzb.tar - 阅读全文
posted @ 2012-08-30 20:24 rorshach 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 主页:http://packages.python.org/APScheduler/index.html 阅读全文
posted @ 2012-08-23 01:40 rorshach 阅读(193) 评论(0) 推荐(0) 编辑
摘要: mongodb数据增加和查找1.增加数据表a.方法一db.tablename.insert({"col1":value,"col2":value})b.方法二db.createCollection(tableName,{capped:true,size:10000})//capped表示该集合结构... 阅读全文
posted @ 2012-08-13 00:32 rorshach 阅读(181) 评论(0) 推荐(0) 编辑
摘要: mongodb一.下载安装二.启动服务端:进入bin目录下,mongod.exe-port27017-dbpathc:/mongodb以上指定了端口27017(默认端口),数据文件放在c:/mongodb三.SHELL连接:进入bin目录下,使用mongo.exe连接也可以使用http://loc... 阅读全文
posted @ 2012-08-03 22:53 rorshach 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 核心思想:将一个列表每次二等分,直到每个二等分中中剩下一个元素,然后排序这两个二等分代码示例:#-*-coding:utf-8-*-defmarge(l,r):results=[]i,j=0,0whilei<len(l)andj<len(r):"确保每一次循环不至于超出两个列表范围"ifl[i]<... 阅读全文
posted @ 2012-07-22 17:20 rorshach 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 核心思想:插入排序就是每一步都将一个待排数据按其大小插入到已经排序的数据中的适当位置,直到全部插入完毕.数据演示:[1,4,2,3]第一次:[1,4,2,3]第二次:[1,4,2,3]第三次:[1,2,4,3]第四次:[1,2,3,4]代码示例如下:definsert_sort(t):foriin... 阅读全文
posted @ 2012-07-15 18:38 rorshach 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 核心思想:传入一个数组,程序从前往后比较,如果第一个元素比第二个元素大,则交换位置,否则保持不变.第三个元素比第二个元素大,则和第二个元素交换位置,依此类推.算法复杂度为:n的2次方,n为元素个数.是效率较为低下的一种算法.冒泡算法每次只是相邻元素交换位置.演示代码:(python)#-*-cod... 阅读全文
posted @ 2012-07-10 23:04 rorshach 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 编辑/etc/rc.local文件加入相应的脚本即可 阅读全文
posted @ 2012-05-25 16:06 rorshach 阅读(1117) 评论(0) 推荐(0) 编辑
摘要: 一、DEBIAN下安装软件在一些情况下,Debian默认安装源可能会出现问题。需要更新下源:1.在/etc/apt/sources.list中添加debhttp://http.us.debian.org/debian/stablemain2.执行以下命令更新软件包列表:apt-getupdate3... 阅读全文
posted @ 2012-05-23 15:13 rorshach 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 文件在/etc/apache2/apache2.conf,前提是要确认是prefork MPM,做如下修改StartServers 5MinSpareServers 5MaxSpareServers 10ServerLimit 5500MaxClients 5000MaxRequests... 阅读全文
posted @ 2012-05-23 10:03 rorshach 阅读(148) 评论(0) 推荐(0) 编辑
摘要: increment($key, 1);if( $count === false ){ $memcache->add($key, 1); exit();}if($count==1000){ $memcache->set($key,0,false,0); /*write db*/}?> 阅读全文
posted @ 2012-04-01 00:51 rorshach 阅读(183) 评论(0) 推荐(0) 编辑
摘要: Varnish反向代理缓存1.用Nginx作为前端代理,用Apache作为后端服务修改nginx的配置文件,使其监听8002端口,并作为apache的反向代理,将所有的php文件转发到后端location ~ \.*${proxy_pass localhost:80;}2.修改varnish的配置... 阅读全文
posted @ 2012-04-01 00:43 rorshach 阅读(176) 评论(0) 推荐(0) 编辑
摘要: http://yylinvip.blog.163.com/blog/static/150078020120125937237/ 阅读全文
posted @ 2012-03-27 00:18 rorshach 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 内存缓存目前不推荐使用Apache缓存系统Apache 从2.0开始就已经可以使用缓存模块了,不过在2.0的时候还是实验性的,到了2.2已经完全可以放心的使用。Apache 的缓存实现主要依靠 mod_cache、mod_disk_cache、mod_file_cache 及 mod_mem_ca... 阅读全文
posted @ 2012-03-27 00:16 rorshach 阅读(326) 评论(0) 推荐(0) 编辑
摘要: mysqlreport 是在linux下更方便查看mysql的状态,用perl编写。使用方法:mysqlreport -user root -password root输出易于阅读的mysql相关信息 阅读全文
posted @ 2012-03-24 00:08 rorshach 阅读(158) 评论(0) 推荐(0) 编辑
摘要: fsck用来扫描和恢复系统文件 阅读全文
posted @ 2012-03-13 22:54 rorshach 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 先安装rsync.aptitude install rsync建立一个空的文件夹mkdir /root/blank用rsync删除目标目录rsync --delete-before -a -H -v --progress --stats /root/blank/ ./cache/这样我们要删除的 ... 阅读全文
posted @ 2012-03-13 13:15 rorshach 阅读(145) 评论(0) 推荐(0) 编辑
摘要: linux的软链接称为符号链接,不受文件系统限制。软链接相当于win下的快捷方式,但作用比快捷方式强大。命令为:ln -s file filesoftfilesoft为要建立的软链接路径删除软链接rm -fr filesoft 阅读全文
posted @ 2012-03-06 04:11 rorshach 阅读(190) 评论(0) 推荐(0) 编辑
摘要: select_type有以下几种值simple,意味着没有子查询和unionsubquery,子查询derived,临时表union,联合union result,结果的联合尽量少用子查询,用联接来完成 阅读全文
posted @ 2012-03-03 11:24 rorshach 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 从最差到最好依次是:all,全表扫描index,索引扫描range,范围扫描,就是一个有限制的索引扫描ref,索引查找eq_ref,使用这种索引查找,mysql最多返回一条记录const,systemNULL 阅读全文
posted @ 2012-03-03 11:18 rorshach 阅读(117) 评论(0) 推荐(0) 编辑
摘要: mysql的锁定表一般适用于myisam引擎的表mysql>lock table tablename write|read;mysql>unlock table;锁定表的目的在于防止其他客户端更改表,保证数据的一致性 阅读全文
posted @ 2012-03-03 11:13 rorshach 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 1.备份mysqldump -uroot -proot dbname tablename>file.sql2.恢复mysql -ruoot -proot dbnamesource file.sql如果第三种方法恢复过慢,可以尝试第二种方法 阅读全文
posted @ 2012-03-03 11:08 rorshach 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Mysql中的内存分配相关配置参数 每个连接到MySQL服务器的线程都需要有自己的缓冲,默认为其分配256K。事务开始之后,则需要增加更多的空间。运行较小的查询可能仅给指定的线程增加少量的内存消耗,例如存储查询语句的空间等。但如果对数据表做复杂的操作比较复杂,例如排序则需要使用临时表,此时会分配大约 阅读全文
posted @ 2012-03-01 22:49 rorshach 阅读(477) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 下一页