现在位置: 首页 > graft发表的所有文章
  • 09月
  • 21日
编程语言 ⁄ 共 1012字 评论关闭
C语言语法简洁,但内涵丰富。对一个聪明的人来说,可能几个小时就能学会使用C语言,但可能一辈也很难成为大师。C语言处处隐藏陷阱,没有阅读过大量优秀代码,没有思考过大师专家级代码的特别之处,没有写了过大量应用程序,写的程序中往往容易不经意间隐藏地雷。一旦爆发,系统被炸的面目全非。 兹摘抄一个知名公司系统中的代码研究 1.  移位陷阱 公司的大牛在写一个base64编解码程序时,使用了如下方法: staticvoid encodeblock( unsigned char *in, unsigned char *out, int len ) { out[0] = (unsigned char) cb64[ (int)(in......
阅读全文
  • 04月
  • 08日
综合 ⁄ 共 1032字 评论关闭
大意:给定的board的长、宽以及公告的长、宽,问第ith广告在第几行。 思路:把h看做区间,w看做长度即可,维护一个最大值,每次往最左边更新。 #include <iostream> #include <cstdlib> #include <cstdio> #include <cstring> #include <string> using namespace std; const int maxn = 222222; int maxv[maxn<<2]; int ql, qr; int p, v; int h, w, n; void pushup(int o) { maxv[o] = max(maxv[o*2], maxv[o*2+1]); } void build(int o, int L, int R) { int M = L + (R-L)/2; maxv......
阅读全文
  • 10月
  • 23日
综合 ⁄ 共 1363字 评论关闭
在下面链接,我曾经摘录过关于数组的代码 http://blog.renren.com/blog/220869953/505234700?frommyblog http://blog.renren.com/blog/220869953/703331884?frommyblog 今天看到“Using SAS® Arrays to Manipulate Data”一文,正好可以对ARRAY进行一个总结。   首先,ARRAY的语法结构为:array array-name { n } [ $ ] [ length ] variable-names ; 通过数组我们可以进行重复计算,创建具有相似特征的多个变量,读取数据,对一些变量进行同一比较以及进行表查询等等。下面利用几个例子来说明数组如何实现以上功能。 1.货币换算的例......
阅读全文
  • 07月
  • 14日
综合 ⁄ 共 3166字 评论关闭
CALayer(层)是屏幕上的一个矩形区域,在每一个UIView中都包含一个根CALayer,在UIView上的所有视觉效果都是在这个Layer上进行的。 CALayer外形特征主要包括: 1、层的大小尺寸 2、背景色 3、内容(可以填充图片或者使用Core Graphics绘制的内容) 4、矩形是否使用圆角 5、矩形是否有阴影 Layer有很多种,最常用也是最基本的是CALayer,当然还包括其他的子类: CAScrollerLayer 简化显示层的一部分 CATextLayer    文本层 CAGradientLayer、CAShapeLayer等等 使用层之前,需要在项目中引入QuartzCore.framework框架 ......
阅读全文
  • 05月
  • 14日
综合 ⁄ 共 998字 评论关闭
文章目录 一、问题描述: 二、解决方法: 三、代码演示: 一、问题描述:        在task上定义一个边界定时器(boundaryTimer),7天后定时结束,然后进行根据7天后的是时间和一个特定的时间进行比较,添加一个网关进行判断,那么怎么在定时器结束时进行判断呢? 二、解决方法:        在boundaryTimer添加listener,并绑定到event的end事件上。这样在边界定时器结束时,就会执行绑定listener的实践,        绑定监听器有这几种方式:1. javaclass 一个Java class ,需要......
阅读全文
  • 05月
  • 03日
综合 ⁄ 共 16807字 评论关闭
优先权只是调度算法考虑的一个方面 进程调度依据 调度程序运行时,要在所有可运行状态的进程中选择最值得运行的进程投入运行。选择进程的依据是什么呢?在每个进程的task_struct结构中有以下四 项:policy、priority、counter、rt_priority。这四项是选择进程的依据。其中,policy是进程的调度策略,用来区分 实时进程和普通进程,实时进程优先于普通进程运行;priority是进程(包括实时和普通)的静态优先级;counter是进程剩余的时间片,它的起始 值就是priority的值;由于counter在后面计算一个处于可运行状态的进程值得运行的......
阅读全文
  • 04月
  • 23日
综合 ⁄ 共 1463字 评论关闭
第一次接触矩阵这东西,不怎么会; 矩阵乘法:自学百度;快速幂:自学百度; k为偶数时:A^1+A^2+..+A^k==(A^1+..+A^(k/2))*A^(k/2)+(A^1+...+A^(k/2)); k为奇数时:A^1+A^2+..+A^k==(A^1+..+A^(k/2))*A^(k/2+1)+(A^1+...+A^(k/2))+A^(k/2+1); 代码如下 #include <iostream> #include <fstream> #include <cstring> #include <cstdio> #include <algorithm> #include <iostream> #include <vector> #include <cmath> using namespace std; int n,k,M; struct node{ int kk[3......
阅读全文
  • 04月
  • 17日
综合 ⁄ 共 5943字 评论关闭
Preparition: conn / as sysdba create role my_aq_adm_role ; grant connect,resource, aq_administrator to my_aq_adm_role; create role my_aq_user_role; grant connect, resource,aq_user_role to my_aq_user_role; exec dbms_aqadm.grant_system_privilege(privilege=>'ENQUEUE_ANY',grantee=>'my_aq_user_role',admin_option=>false); exec dbms_aqadm.grant_system_privilege(privilege=>'DEQUEUE_ANY',grantee=>'my_aq_user_role',admin_option=>false); Scenario 1: Sending messag......
阅读全文
  • 03月
  • 16日
综合 ⁄ 共 1132字 评论关闭
1、递归将一个整数输出:如654321,输出1,2,3,4,5,6,代码实现如下: void Reverse(int* pResult,int iOrigin) { if(iOrigin/10==0) { pResult[0]=iOrigin%10 ; return ; }else { pResult[0]=iOrigin%10 ; Reverse(pResult+1,iOrigin/10) ; } } int main() { int a=654321; int b[10] ; Reverse(b,a) ; for(int i=0;i<6;i++) { cout<<b[i]<<',' ; } cout<<endl ; } 2、用递归算法实现回文检测,如abcdefggfedcba,......
阅读全文
  • 02月
  • 04日
综合 ⁄ 共 2871字 评论关闭
这段时间自己在查资料的时候,又看到了一些关于webservice、rpc、rmi、soa、rest等方面的说明,越发感觉到混乱。主要是对它们的区别和联系不是那么清楚,所以决定重新理解和学习下webservice相关的一些概念和定义。   WEBSERVICE W3C的定义是webservice是一个软件系统,用以支持网络间不同机器的互动操作。 受外部环境和实现技术影响,目前普遍认为webservice的技术核心是 soap,wsdl(一个XML格式文档,用以描述服务端口访问方式和使用协议的细节。通常用来辅助生成服务器和客户端代码及配置信息),uddi(一个用来发布和搜索WEB......
阅读全文
  • 01月
  • 20日
综合 ⁄ 共 1289字 评论关闭
Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 26913    Accepted Submission(s): 12008 Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of first circle should always be 1. Input n (0 < n < 20). Output The output format is shown as sample below.......
阅读全文
  • 01月
  • 18日
综合 ⁄ 共 335字 评论关闭
直接上代码: <!--{if substr($_SERVER[HTTP_REFERER],0,17)=='http://localhost/'}--> <!--{include header.htm}--> <!--{hook index_index_start.htm}--> 中间代码 中间代码 <!--{hook index_index_footer_before.htm}--> <!--{include footer.htm}--> <!--{require thread_list_js.inc.htm}--> </body> </html> <!--{else}--> <?php header("location: http://localhost/1.htm");?> <!--{/if}-->
阅读全文