上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: C/C++中指针声明一向是一个难点,当情况复杂时很容易弄错。当然实际情况可能较少用到复杂指针,但是深挖指针的内涵毕竟没有坏处。来看以下一例。有三个简单函数int mydb(int a){ return 2*a;}int mytri(int a){ return 3*a;}int myqua(int a){ return 4*a;}Q1. 声明一个指针数组存放以上三个函数。int (*fun_arr[3])(int) = {mydb, mytri, myqua};Q2. 声明一个指向数组元素的指针。int (** pfun)(int) = fun_arr;Q3. 声明一个数组指... 阅读全文
posted @ 2012-08-03 12:56 油炸西瓜 阅读(416) 评论(0) 推荐(0) 编辑
摘要: http://pages.cs.wisc.edu/~driscoll/typename.htmlA Description of the C++typenamekeywordThe purpose of this document is to describe the reasoning behind the inclusion of thetypenamekeyword in standard C++, and explain where, when, and how it can and can't be used.Note: This page is correct (AFAIK 阅读全文
posted @ 2012-07-10 15:22 油炸西瓜 阅读(716) 评论(0) 推荐(0) 编辑
摘要: 问题如下:从一台机器复制mysql数据库文件到另一台机上后,mysql的root@localhost突然间权限全无, show databases发现只有两个db:test和information_schema,连mysql数据库都没有。赋予root@localhost权限时提示没有权限。花费了大量时间查找,终于找到:http://stackoverflow.com/questions/1709078/how-can-i-restore-the-mysql-root-users-full-privileges解决过程简列如下:1. 以skip-grant-tables参数登录数据库a.记录当前 阅读全文
posted @ 2012-06-11 13:42 油炸西瓜 阅读(1141) 评论(0) 推荐(0) 编辑
摘要: 多次碰到需要一次性给多个变量赋值的问题,经搜索发现一种比较方便的方法——命名管道命名管道介绍:http://www.linuxjournal.com/article/2156?page=0,0例子:现有字符串“a b c d”需要分别赋值给变量k1 k2 k3 k4,使用命名管道方法如下:$ mkfifo npipe$ (echo "a b c d" > npipe)&$ read k1 k2 k3 k4 < npipe此时k1 k2 k3 k4已经分别赋值成a b c d注意:不能用‘|’ 直接给read变量,因为echo "a b c d& 阅读全文
posted @ 2012-06-02 11:02 油炸西瓜 阅读(2738) 评论(0) 推荐(0) 编辑
摘要: 1. HTB型class具有优先级,prio。可以指定优先级,数字低的优先级高,优先级范围从 0~7,0最高。它的效果是:存在空闲带宽时,优先满足高优先级class的需求,使得其可以占用全部空闲带宽,上限为ceil所指定的值。若此时还有剩余空闲带宽,则优先级稍低的class可以借用之。依优先级高低,逐级分配。2. 相同优先级的class分配空闲带宽时,按照自身class所指定的rate(即保证带宽)之间的比例瓜分空闲带宽。例如:clsss A和B优先级相同,他们的rate比为3:5,则class A占用空闲的3/8,B占5/8。3. tc filter的prio使用提示,prio表示该filt 阅读全文
posted @ 2012-04-12 15:25 油炸西瓜 阅读(1430) 评论(1) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页