上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页
摘要: 当使用coredata作为app的后台数据存储介质后,我们很想知道数据是否成功插入。为此,我想找到coredata.sqlite的文件代码中指定的存储目录为:- (NSURL *)applicationDocumentsDirectory { return [[[NSFileManagerdefaultManager] URLsForDirectory:NSDocumentDirec... 阅读全文
posted @ 2014-08-13 19:55 姜楠 阅读(1928) 评论(1) 推荐(0) 编辑
摘要: APPLE提供了三种storyboard segue的方式:push,modal,custom . push segue是系统预定义的跳转方式, 为了使其能正常工作,我们还必须加载UINavigationController。 有时候,我们不想看到UINavigation bar,我们可以使用mod 阅读全文
posted @ 2014-08-01 11:02 姜楠 阅读(1805) 评论(0) 推荐(1) 编辑
摘要: 本程序的主要目标是展示如何解析所捕获的数据包的协议首部。 这个程序可以称为UDPdump,打印一些网络上传输的UDP数据的信息。 1: #include"pcap.h" 2: typedef struct ip_address{ 3: u_char byte1,byte2,byte3,byte4; 4: }ip_address; 5: typedef st... 阅读全文
posted @ 2014-05-15 16:14 姜楠 阅读(1337) 评论(0) 推荐(0) 编辑
摘要: 1: #include"pcap.h" 2: //每次捕获到数据包时,libpcap都会自动调用这个回调函数 3: void packet_handler(u_char *param,const pcap_pkthdr*header,const u_char *ptk_data){ 4: 5: char timestr[16]; 6: ... 阅读全文
posted @ 2014-05-07 09:43 姜楠 阅读(559) 评论(0) 推荐(0) 编辑
摘要: WinPcap中文API http://www.ferrisxu.com/WinPcap/html/index.html 1: #include"pcap.h" 2: #include 3: #define IPTOSBUFFERS 12 4: char *iptos(u_long in){ 5: static char output[IPTOSBUF... 阅读全文
posted @ 2014-05-07 09:01 姜楠 阅读(685) 评论(0) 推荐(0) 编辑
摘要: (1).秦九韶算法:把一个N次的多项式,改写成如下形式:\[\begin{array}{l}f( x ) = a_n{x^n} + a_{n - 1}x^{n - 1} + \cdots + {a_1}x + a_0\\= ( {a_n}x^{n - 1} + a_{n - 1}x^{n - 2} ... 阅读全文
posted @ 2014-04-10 13:20 姜楠 阅读(355) 评论(0) 推荐(0) 编辑
摘要: 题意:集合A,B,计算集合差A-B(求只在集合A内的数) 解法: 选用STL内的集合set 1.建立set 1: #include 2: 3: set se;2.关于集合的遍历,固定的格式:用容器的iterator访问所有数据。 1: for(set::iterator it=a.begin();it!=a.end();it++){ 2: //TO DO ... 阅读全文
posted @ 2014-04-10 12:27 姜楠 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 题意:(略)太长了 解法:找规律,发现A[i]=A[i-1]*2-2; 1: #include 2: #include 3: #include 4: #include 5: #define N 31 6: int a[N]={3}; 7: void init(){ 8: int i; 9: for(i=1;i<N;i++){ ... 阅读全文
posted @ 2014-04-09 23:05 姜楠 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题意:求解多边形面积 解法: 先了解数学上“叉积”的含义与性质: 三角形ΔABC的面积为: 我们可以依次计算每个三角形的面积,ΔABC,ΔACE,ΔEF … … 所有三角形的面积之和为整个多边形的面积. 每次计算由A0,Ai,Ai+1组成的三角形 代码: 1: #include 2: #include 3: #include 4: #include 5... 阅读全文
posted @ 2014-04-09 21:34 姜楠 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 题意:区间调度问题 解法:应用贪心算法,贪心的规则: 在可选的节目中,选取结束时间早的节目。 1: #include 2: #include 3: #include 4: #define N 101 5: struct time{ 6: int s,t; 7: }timer[N]; 8: int comp(const void *p,con... 阅读全文
posted @ 2014-04-09 20:43 姜楠 阅读(191) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页