码迷,mamicode.com
首页 >  
搜索关键字:for while    ( 28479个结果
Error prompt:“xxx is not in the sudoers file”----Solution
//Situation System prompts"xxx is not in the sudoers file"(xxx equals the user name)while executing command "sudo": sudo-i Password: xxx ...
分类:其他好文   时间:2014-07-06 21:39:36    阅读次数:175
【设计模式】桥接模式
前言 从方向上改变糟糕的代码设计,如果你还是很直白的过程式思维,还在被一大堆的if else,随处可见的for、while所困扰,是时候学习设计模式了。 正文 软件设计中的合成/聚合复用原则:尽量使用合成/聚合,尽量不要使用类继承。 合成和聚合都表示关联的特殊种类。聚合表示一种弱的”拥有“关系,体....
分类:其他好文   时间:2014-07-06 19:21:45    阅读次数:176
Welcome to Swift (苹果官方Swift文档初译与注解二十六)---181~188页(第四章-- 流程控制)
Do-While while循环的另一个版本是do-while循环,它在判断条件之前,先执行一遍循环体,然后再次执行循环体,直到条件成为false. do-while循环的通过格式: do { statements } while condition 我们再用蛇和梯子...
分类:移动开发   时间:2014-07-06 18:18:24    阅读次数:252
水仙花数
/*Input输入数据有多组,每组占一行,包括两个整数m和n(100#includeint main(){int m,n,k,ge,shi,bai;int flag=0;while(scanf("%d%d",&m,&n)!=EOF){ flag=0; if(m>n || m999) ...
分类:其他好文   时间:2014-07-06 13:41:48    阅读次数:196
二分查找
templateint binarySearch(const vector &a, const comparable &x){ int low = 0, high = a.size() - 1; while(low a[center]) low = center ...
分类:其他好文   时间:2014-07-06 13:10:01    阅读次数:188
error while loading shared libraries: libpcre.so.1: cannot open shared object file
执行启动nginx:/usr/local/nginx/sbin/nginx    错误:/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory     查找:[roo...
分类:其他好文   时间:2014-07-06 00:11:52    阅读次数:205
python 逐行读取文本
f = open("foo.txt") # 返回一个文件对象line = f.readline() # 调用文件的 readline()方法while line: print line, # 后面跟 ',' 将忽略...
分类:编程语言   时间:2014-07-05 21:24:54    阅读次数:287
[Linux]Centos git报错fatal: HTTP request failed
在使用git pull、git push、git clone会报类似如下的错误: error: The requested URL returned error: 401 Unauthorized while accessing https://git.oschina.net/zemo/demo.git/info/refs fatal: HTTP request failed 一般...
分类:系统相关   时间:2014-07-04 09:27:03    阅读次数:589
分解质因数算法
分解质因数算法 1.从N开始递减,找到满足 : n%i ==0 && n是素数 -> result2.存result到数组,递归执行(n/result)var result = new Array(); var factor = function f(n){ if(n == 1){return ;} var n1 = n; while(n1>1){ if(isPrime(n1) && n ...
分类:其他好文   时间:2014-07-04 07:21:41    阅读次数:237
[算法]将字符串中的*前置,非*字符相对位置不变
如ab**cd*e12变成 ****abcde12char* foo(char* str, int length){ int i = length-1,j = length-1; while(i >= 0 && j >= 0){ while(i >= 0 && '*' !=...
分类:其他好文   时间:2014-07-03 23:52:49    阅读次数:314
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!