- 博客(20)
- 收藏
- 关注
原创 约瑟夫问题
/* 约瑟夫问题 犹太人有这样的故事:罗马人占领乔塔帕特后,39个犹太人与约瑟夫及他的朋友躲到一个洞里,犹太人决定宁愿死也不要被敌人逮到,于是决定了一个自杀方式,41个人排成一个圈,由第1个人开始报数,每报数到第3个,该人就必须自杀,然后再由下一个重新报数,直到所有人都自杀身亡为止。 现在假设您不幸参与了这个游戏,共有N个人,如何让自己成为最后一个报数者,成功逃生。假设有41个人
2015-12-31 10:15:14
875
原创 Auto Layout
/*设置顶部图片*/ UIImageView *headerView = [[UIImageViewalloc] init]; headerView.translatesAutoresizingMaskIntoConstraints =NO; headerView.image = [UIImageimageNamed:@"btn_scroll_pictur
2015-10-09 18:14:22
368
原创 iOS异步加载缓存图片
- (void)viewDidLoad { [superviewDidLoad]; imageView = [[UIImageViewalloc] init]; [imageViewsetBackgroundColor:[UIColorgrayColor]]; imageView.frame =CGRectMake(60,60, 20
2015-10-08 18:50:18
542
转载 Mac终端编写编译C程序的实例
步骤:创建C文件、用Vim编写C程序、编译C程序文件、执行编译后生成的.out文件。1、touch Hello.c //创建一个Hello.c文件(本目录下)2、vim Hello.c //用vim编辑Hello.c文件 //打开vim后先输入i进入
2015-09-08 10:23:54
602
转载 NSOperation
一.NSOperation NSOperation是抽象基类,因此必须使用它的子类,使用NSOperation子类的方式有2种: (1) Foundation框架提供了两个具体子类直接供我们使用:NSInvocationOperation和NSBlockOperation (2) 自定义子类继承NSOperation,实现内部相应的方法
2015-07-30 14:48:53
464
原创 日期格式化
NSDate * nowDate = [NSDatedate]; NSDateFormatter *dateFormatter = [[NSDateFormatteralloc]init]; [dateFormattersetDateFormat:@"MMMM dd, yyyy 'at' hh:mm a"]; NSString * dateString =
2015-07-15 17:21:41
420
原创 NSURLConnection Get
NSString *cityString = [@"南京"stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *weatherString = [NSStringstringWithFormat:@"http://v.juhe.cn/weather/index?cityname=%@&
2015-06-25 16:14:47
434
原创 iOS手势
- (void)viewDidLoad{ [superviewDidLoad]; _rotateImageview = [[UIImageViewalloc]initWithFrame:CGRectMake(0,0, [UIScreenmainScreen].bounds.size.width, [UIScreenmainScreen].bo
2015-05-29 11:29:46
530
转载 FFmpeg在iOS上编译
准备条件1.先下载文件:https://github.com/libav/gas-preprocessor复制gas-preprocessor.pl到/usr/sbin下,修改文件权限:chmod 777 /usr/local/bin/gas-preprocessor.pl2.安装yasm curl http://www.tortall.net/
2015-05-28 15:45:07
575
转载 Git解决fatal: unable to connect to github.com
命令:bower install jquery 【mac】错误信息:bower error status code of git: 128fatal: unable to connect to github.com:github.com[0: 你的IP]: errno=Operation timed out原因:需要用https才能读到数据解决方法:输入命令
2015-05-15 14:39:48
9441
转载 Xcode注释插件vvDocumenter
1.前往GitHub下载工程文件:https://github.com/onevcat/VVDocumenter-Xcode2.用Xcode打开工程,Command + B Build成功后,可以在~/Library/Application Support/Developer/Shared/Xcode/Plug-ins目录下看到生成的VVDocumenter-Xcode.xcplugi
2015-05-08 16:17:52
479
原创 ipa终端打包
配置好证书,然后在命令行转到项目目录(GC.xcodeproj)1.清除archerminddeMac-mini:GC2.3877 archermind$ xcodebuild clean2.编译archerminddeMac-mini:GC2.3877 archermind$xcodebuild -target GC-configuration Release
2015-04-21 17:26:05
472
转载 iOS 获取文件夹
获取应用Home文件夹NSString* homePath = NSHomeDirectory();/Applications/5426E9E9-AC0B-4304-A17D-59A8AFFEA1A5获取Document文件夹NSArray* pathes = NSSearchPathForDirectoriesInDomains(NSD
2014-11-03 10:41:35
453
转载 优先使用对象组合,而不是使用继承
先转载一个例子:继承例子:public class MyStack extends Vector{ public void push(Object element){ insertElementAt(element, 0); } public Object pop(){ Object result = firstElemen
2014-01-17 17:42:25
1367
原创 java备份还原mysql数据库
bat文件:@echo offset errorlevel=0set path_home_mysql="C:\Program Files\MySQL\MySQL Server 5.1\"set path_bin_mysql=%path_home_mysql%bin\set backup_dir="C:\backup\"set backup_file=%backup_di
2014-01-14 16:36:43
591
原创 tomcat项目路径重定向
server.xml在中新建Context: 其中path是虚拟路径,docBase是JSP应用程序的物理路径,workDir是这个应用的工作目录,存放运行是生成的于这个应用相关的文件。 启动Tomcat,可通过http://localhost:8080访问Jiazheng这个jsp应用了
2014-01-14 15:55:52
2006
原创 mysql还原数据库:java.io.IOException: 管道已结束
Runtime runtime = Runtime.getRuntime();Process process = runtime.exec("C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin\\mysql.exe -hlocalhost -uroot -p1234 --default-character-set=utf8 buddha");Ou
2014-01-13 13:38:59
3676
转载 mysql解决自动断开8小时未曾用过的连接
近来发现mysql在第二天总是断开,于是在网上查找解决方式:下面转载自:http://www.cnblogs.com/neonlight/archive/2008/11/28/1276178.html近一段时间,很多部门同事反映在使用mysql的过程出现数据库连接自动断开的问题,我对该问题做了一些实验。关于mysql自动断开的问题研究结果如下,在mysql中有相关参数设定,当数据库
2014-01-09 09:18:09
689
原创 MyEclipse搭建S2SH框架
1.创建web工程,创建数据库2.添加连接池:(1)需要添加的jar包:commons-logging.jar,proxool-0.9.1.jar,proxool-cglib.jar和mysql-connector-java-5.1.8-bin.jar(2)在WEB-INF下创建proxool.xml文件:mysqljdbc:mysql://localhost:33
2014-01-08 17:30:26
1009
原创 纯净版eclipse添加web支持,配置tomcat
1.首先下载eclipse3.3,tomcat6(安装版),lomboz3.3(1)eclipse解压即可(2)tomca6下载地址:地址http://tomcat.apache.org/download-60.cgi(3)lomboz下载地址是:http://forge.ow2.org/project/showfiles.php?group_id=97选择org.objectwe
2013-12-19 11:26:40
1674
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人