现在位置: 首页 > scribe发表的所有文章
  • 10月
  • 15日
综合 ⁄ 共 1580字 评论关闭
学过数据结构的人都知道,用于查找的数据结构有: (1)线性表; (2)树; (3)Hash表; 很明显Hash的查找是最快的。 问题:但是为什么数据库像MySQL,Oracle,SyBase,MS SqlServer都是使用B+或者B-树来存储数据库索引的。那么他们为什么都是用树,而不是速度更快的Hash表来存储索引呢??? 任何事物都是有两面性的,Hash索引也一样,虽然Hash索引效率高,但是 Hash索引本身由于其特殊性也带来了很多限制和弊端,主要有以下这些。   (1)Hash索引仅仅能满足"=","IN"和"<=>"查询,不能使用范围查询。   由于 Hash索引......
阅读全文
  • 08月
  • 27日
综合 ⁄ 共 2302字 评论关闭
UINavigationController通过栈来实现。添加一个Controller为入栈,释放一个Controller为出栈。复习下栈: 1。栈是先进后出 2。栈顶是最后一个入栈的对象 3。基栈是是第一个入栈的对象(栈底) UINavigationController经常使用的函数: (1)- (id)initWithRootViewController:(UIViewController *)rootViewController 添加根视图控制器,最先显示。 (2)- (void)pushViewController:(UIViewController *)viewControlleranimated:(BOOL)animated; Controller入栈操作 (3)- (UIViewController*)popViewControllerAnimated:(BOOL)......
阅读全文
  • 07月
  • 31日
综合 ⁄ 共 226字 评论关闭
http://acm.hdu.edu.cn/showproblem.php?pid=2551 //水题 #include <iostream> #include <cmath> using namespace std; int main() { int t, n, x; int i, j; cin >> t; while (t--) { cin >> x; n = 0; i = 1; while (x > 0) { n++; x = x - pow((double)i,3); i++; } cout << n << endl; } return 0; }  
阅读全文
  • 04月
  • 19日
综合 ⁄ 共 2736字 评论关闭
文章目录 1、uml建模: 2、代码实现 1、uml建模: 2、代码实现 转载请注明出处:http://blog.csdn.net/lhy_ycu/article/details/39856435 代理模式(Proxy):代理模式其实就是多一个代理类出来,替原对象进行一些操作。比如咱有的时候打官司需要请律师,因为律师在法律方面有专长,可以替咱进行操作表达咱的想法,这就是代理的意思。代理模式分为两类:1、静态代理(不使用jdk里面的方法);2、动态代理(使用jdk里面的InvocationHandler和Proxy)。下面请看示例: 一、静......
阅读全文
  • 01月
  • 11日
综合 ⁄ 共 7052字 评论关闭
1.干货写在前面 协程是一种用户态的轻量级线程。本篇主要研究协程的C/C++的实现。 首先我们可以看看有哪些语言已经具备协程语义: 比较重量级的有C#、erlang、golang* 轻量级有python、lua、javascript、ruby 还有函数式的scala、scheme等。 c/c++不直接支持协程语义,但有不少开源的协程库,如: Protothreads:一个“蝇量级” C 语言协程库 libco:来自腾讯的开源协程库libco介绍,官网 coroutine:云风的一个C语言同步协程库,详细信息 目前看到大概有四种实现协程的方式: 第一种:利用glibc 的 ucontext组件(云风的库) 第......
阅读全文
  • 10月
  • 22日
综合 ⁄ 共 2271字 评论关闭
FROM<Multiple Graphs on One page, the easy way (PDF) and the hard way (RTF>     样本数据: data spiral; do theta=1 to 1080 by .1; r=.75 + sin((.25*theta)); x=r*cos(theta); y=r*sin(theta); output; end; run; data star; do theta=1 to 1080 by .75; r=sin((5)*theta); x=r*cos(theta); y=r*sin(theta); output; end; run; data colors; do theta=1 to 5760 by 1; r=sin((sqrt(3/2))*theta); x=r*cos(thet......
阅读全文
  • 10月
  • 09日
综合 ⁄ 共 517字 评论关闭
// // // // // // // //  ///2012/10/18 // // // // // // // //  缩进规则(一)。   一般而言, 在花括号中的语句应当比上一级缩进一个Tab的距离。   然而, 还是有一些特殊的情况的。 比如说if:   if(a > 0)    a--; 像这样的单行if语句,如果不是很长的话 最好写在一行中。  if(a > 0) a--; // // // // // // // //  ///2012/10/19 // // // // // // // //  缩进规则(二)。   缩进的原则就是代码整齐, 所以在实际编程中, 即使没有预先的规范, 但遇到使用的函数参数比较多的情况下(当然在函数参数最好不要超过三......
阅读全文
  • 07月
  • 25日
综合 ⁄ 共 5335字 评论关闭
论坛上有人问如何在CHtmlView中判断页面加载完成。这里给出一点想法。 首先想想这个问题如果是在JS里面是如何实现的。 JS里面最简单的方式就是利用onload事件让一段JS在页面加载完成后启动。 使用onload事件的好处是,能够保证页面上的image图片都已经加载完成。 比如: window.onload = function() { // do something } // 或者 window.attachEvent( "onload", function(){ // do something } ); 这两种写法稍有不同。 对于前者,是直接替换了onload的处理句柄,也就是说,如果......
阅读全文
  • 05月
  • 18日
综合 ⁄ 共 1997字 评论关闭
// //  VRope.h - 0.3 // //  Updated by patrick on 28/10/2010. // /* Verlet Rope for cocos2d   Visual representation of a rope with Verlet integration. The rope can't (quite obviously) collide with objects or itself. This was created to use in conjuction with Box2d's new b2RopeJoint joint, although it's not strictly necessary. Use a b2RopeJoint to physically constrain two bodies in a box2d world and use VRope to visually draw the rope in cocos2d. (or just draw the rope between two moving......
阅读全文
  • 04月
  • 23日
综合 ⁄ 共 511字 评论关闭
背景:简单字符串处理,虽然有点绕。 #include<cstdio> #include<iostream> #include<cstring> #include<queue> #include<algorithm> using namespace std; int ans[510]; char str[1009]; int main(void){ while(~scanf("%s",str)){ memset(ans,0,sizeof(ans)); int n=strlen(str),m=0; for(int i=0;i < n;){ bool x=true; for(int j=0;;j++){ if(i == n) break; int key=str[i]-'0'; ......
阅读全文
  • 02月
  • 22日
综合 ⁄ 共 2460字 评论关闭
The Lamp Game Time Limit: 2 Seconds Memory Limit: 65536 KB Little Tom likes playing games. Recently he is fond of a game called Lamp Game. The game is like this: at first, there are n lamps on the desk, all of which are lighted and Tom is given an initial score. Each time, Tom selects one lamp and changes its state, this action will costs little Tom some percent of score. What's more, the circuit of the lamps is designed so that, when Tom changes the state of one lamp, some related la......
阅读全文
  • 01月
  • 09日
综合 ⁄ 共 488字 评论关闭
我们在使用linux虚拟机的时候,经常会遇到诸如需要来回切换鼠标、屏幕窗口太小、无法在windows和虚拟机之间拖动文件等情况。这些问题可以通过安装VMware Tools来解决,下面来价绍一下解决方法。 下面来说一下安装VM Tools的过程。 1.       init 5,重启打开图形界面,以ROOT身份进入Linux。 2.       在VMware的导航条上找到VM选项卡,点击其中的Install VMware Tools,屏幕上会出现一个vmware tools窗口,将里面的VMwareTools-9.2.0-799703.tar.gz复制到了/home/hcm/Desktop文件夹下。 3.       命令行中输入tar zxf VMwareTo......
阅读全文