现在位置: 首页 > trove发表的所有文章
<style type="text/css"> body{font-size:24px; font-family:Tahoma;} .checkbox{vertical-align:middle; margin-top:0;} </style> </head> <body> <input class="checkbox" type="checkbox" />使用css式样的复选框 <input  type="checkbox" />默认的复选框     在实际运用中会出现firefox与ie效果不同的情况这时候需要   .comm_check{margin:2px 2px 0 30px; float:left; vertical-align:middle;margin-top:3px!important ;margin-top:0px;} *格式:适用于ff 的配置   !important ;  适用于i......
阅读全文
  • 11月
  • 09日
综合 ⁄ 共 659字 评论关闭
一个数列通过两两相邻的数进行交换得到一个升序的数列需要交换的次数,等于这个数列的逆序数 逆序数:例如数列{3,1},{3,1,2}这两个数列的逆序数各位1和2 这里数据太大,通过离散化进行树状数组求逆序数。 离散化:通过排序和映射即可实现 #include<iostream> #include<cstring> #include<algorithm> using namespace std; #define MAX 500000 struct hehe { int pos,val; friend bool operator <(hehe a,hehe b) { return a.val<b.val; } }b[MAX]; int a[MAX],n; void update(int i,int va......
阅读全文
  • 04月
  • 17日
综合 ⁄ 共 268字 评论关闭
  Currently I want to transfer all my local database to the remote server and I found a very simple solution.   (1) Backup your database [1]   (2) Transfer the backup to the destination server.   (3) Restore the database on the server.[2] Reference:   [1] http://www.postgresguide.com/utilities/backup-restore.html
阅读全文
  • 02月
  • 19日
综合 ⁄ 共 2939字 评论关闭
        RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j之间的最小/大值。       该篇文章主要讲一下ST (Sparse Table) 算法,复杂度 O(nlogn) - O(q) online。其核心就是动态规划。好吧,太久没写博客,刚刚帐号密码什么的都忘了,找回找了超久,本来不打算写的,可是因为怕自己学的也会忘记,所以就花点时间写写,上次是腿伦给我们上的课,可是早就忘记了,今天又回过头来看了一下,应该可以写点什么(不足的地方以......
阅读全文
  • 02月
  • 17日
综合 ⁄ 共 2132字 评论关闭
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have two friends. You want to present each of them several positive integers. You want to present cnt1 numbers to the first friend and cnt2 numbers to the second friend. Moreover, you want all presented numbers to be distinct, that also means that no number should be presented to both friends. In addition, the first friend does not like the num......
阅读全文
  • 02月
  • 07日
综合 ⁄ 共 2901字 评论关闭
1.输入输出中的<<和>>是移位操作符的重载; 2.可以重载的操作符: + - * / % ^ & | ~ ! , =  <  >  <=  >=  ++  -- << >> ==  != && ||  += -= /= %= ^= &= |= *= <<= >>= [] () ->  ->*  new new []  delete  delete []  3.不能重载的操作符: ::    .*   .   ?: 4.通过连接其他合法符号可以创建新的操作符。例如,定义一个 operator**以提供求幂运算是合法的。 5.用于内置类型的操作符,其含义不能改变。例如,内置的整型加号操作符不能重定义 6.重载操作符......
阅读全文
  • 01月
  • 02日
综合 ⁄ 共 1684字 评论关闭
Mac与Phy组成原理的简单分析 1  1. general 下图是网口结构简图。网口由CPU、MAC和PHY三部分组成。DMA控制器通常属于CPU的一部分,用虚线放在这里是为了表示DMA控制器可能会参与到网口数据传输中。 对于上述的三部分,并不一定都是独立的芯片,根据组合形式,可分为下列几种类型: 方案一:CPU集成MAC与PHY; 方案二:CPU集成MAC,PHY采用独立芯片; 方案三:CPU不集成MAC与PHY,MAC与PHY采用集成芯片; 本例中选用方案二做进一步说明,因为CPU总线接口很常见,通常都会做成可以像访问内存一样去访问,没必要拿出来说,而Mac与PHY......
阅读全文
  • 07月
  • 13日
综合 ⁄ 共 2287字 评论关闭
虽然大家都不愿意看到程序崩溃,但可能崩溃是每个应用必须面对的现实,既然崩溃已经发生,无法阻挡了,那我们就让它崩也崩得淡定点吧。 IOS SDK中提供了一个现成的函数 NSSetUncaughtExceptionHandler 用来做异常处理,但功能非常有限,而引起崩溃的大多数原因如:内存访问错误,重复释放等错误就无能为力了,因为这种错误它抛出的是Signal,所以必须要专门做Signal处理。 在didFinishLaunchingWithOptions 中,加入 代码如下: Source code    [html] view plaincopy signal(SIGABRT, MySignalHandler);      ......
阅读全文
  • 05月
  • 27日
综合 ⁄ 共 8133字 评论关闭
选自 Graphcs shaders : Theory  and practice 2 OpenGL 2.0/GLSL 1.10 This version of OpenGL introduces shader-based graphics programming, including programmable vertex and fragment shaders and the GLSL language. Each of these is the subject of a later chapter in this book.These shaders restore an enormous amount of flexibility and creativity to OpenGL graphics programming, and in some sense all the later OpenGL developments are mainly evolutions of this approach. This version includes a fe......
阅读全文
  • 04月
  • 04日
综合 ⁄ 共 2145字 评论关闭
成帧的方式 1.基于定界符(Delimiter-based)   2.显式长度(Explicit length)     接口: import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * Framer接口。 * frameMsg()方法用来添加成帧信息并将指定消息输出到指定流 * nextMsg()方法则扫描指定的流,从中抽取出下一条消息。 * @authorLyn * */ publicinterface IFramer { void frameMsg(byte[] message,OutputStream out) throws IOException; byte[] nextMsg(InputStream in)throws IOException; }  ......
阅读全文
  • 03月
  • 23日
综合 ⁄ 共 564字 评论关闭
当一个进程调用f o r k时,其子进程继承父进程的信号处理方式。因为子进程在开始时复制了父进程存储图像,所以信号捕捉函数的地址在子进程中是有意义的;     #include <sys/types.h> #include <unistd.h> #include <signal.h> #include <iostream> using namespace std; void sig_handle(int signo){ cout << "---------------------------"<< endl; cout << getpid() << ":" <<signo; } int main(int args,char *argc[]){ signal(SIGUSR1,sig_handle); pid_t pid; ......
阅读全文
  • 02月
  • 19日
综合 ⁄ 共 3342字 评论关闭
  #======================R-demonstration script============================= #--------------------------start and quit--------------------------------- R quit() save.image() #save data, although I would just copy code into a text file. Same as quit("yes") #---------------------------comments-------------------------------------- #Text after pound sign is ignored (considered to be comments) #----------------------------help----------------------------------------- help("matrix") #or ?matri......
阅读全文