上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 109 下一页

2015年8月11日

1085. Perfect Sequence (25) -二分查找

摘要: 题目如下: Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M #include #includ... 阅读全文

posted @ 2015-08-11 14:27 张大大123 阅读(171) 评论(0) 推荐(0) 编辑

1083. List Grades (25)

摘要: 题目如下: Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing... 阅读全文

posted @ 2015-08-11 14:17 张大大123 阅读(159) 评论(0) 推荐(0) 编辑

2015年8月10日

(一一六)新浪微博客户端的离线缓存实现思路

摘要: 上一节(一一五)利用NSKeyedArchiver实现任意对象转为二进制介绍了将任意对象转化为二进制数据和还原的方法,可用于实现本节介绍的微博数据离线缓存。 通过新浪官方的API可以发现,返回的微博数据如下样式: { "statuses": [ { "c... 阅读全文

posted @ 2015-08-10 22:49 张大大123 阅读(479) 评论(0) 推荐(0) 编辑

(一一五)利用NSKeyedArchiver实现任意对象转为二进制

摘要: 【应用背景】 在数据库中存储数据时,如果对象过于复杂,又不必要创建复杂的表,可以直接把整个对象转化为二进制存入数据库字段,然后取出后再还原即可。 【实现方法】 在PHP中,使用序列化和反序列化可以实现这样的功能。 在OC中,使用NSKeyedArchiver和NSKedUnarchiver可以实... 阅读全文

posted @ 2015-08-10 22:32 张大大123 阅读(185) 评论(0) 推荐(0) 编辑

(二)表的连接与外键约束

摘要: 外键约束和表连接 【建立表的关系】 1.额外建立一张表描述两个表之间的关系,存储两张需要连接的表的主键对应关系。 2.利用外键约束 外键:一张表的某个字段引用着另一张表的主键,在数据多的表中多一个字段,存储对应的另一张表的主键。 外键的创建: CONSTRAINT FOREIGN K... 阅读全文

posted @ 2015-08-10 20:35 张大大123 阅读(292) 评论(0) 推荐(0) 编辑

1082. Read Number in Chinese (25)

摘要: 题目如下: Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output "Fu" first if it is negativ... 阅读全文

posted @ 2015-08-10 17:56 张大大123 阅读(275) 评论(0) 推荐(0) 编辑

2015年8月9日

(一一四)使用FMDB操作SQLite数据库

摘要: 上节介绍了用系统自带的C语言库操作SQLite的方法,比较繁琐,使用FMDB会大幅度简化,并且是面向对象的,使用十分方便。 使用步骤如下: 先从github下载FMDB框架,然后把它导入工程。 ①导入libsqlite3.0.dylib库。 ②导入主头文件FMDatabase.h。 ③创建数据库... 阅读全文

posted @ 2015-08-09 23:51 张大大123 阅读(165) 评论(0) 推荐(0) 编辑

(一一三)使用系统自带框架操作SQLite3数据库

摘要: 系统自带的框架是基于C语言的,使用比较繁琐。 下面是使用步骤: 首先导入libsqlite3.0.dylib。 ①在Document目录下打开数据库,如果没有则创建。 NSString *sqlitePath = [[NSSearchPathForDirectoriesInDomains(NSD... 阅读全文

posted @ 2015-08-09 23:23 张大大123 阅读(200) 评论(0) 推荐(0) 编辑

(一)SQLite与SQL语句基础

摘要: 数据库一般分为 关系型和对象型,关系型是主流,对象型数据库是直接把对象存入数据库。 常用关系型数据库: PC:Oracle MySQL SQL Server DB2 嵌入式/移动端:SQLite 本文主要介绍SQLite的基本情况与SQL基本语句。 1.SQLite实际无类型,但是表层划分数据... 阅读全文

posted @ 2015-08-09 22:22 张大大123 阅读(234) 评论(0) 推荐(0) 编辑

1078. Hashing (25)

摘要: 题目如下: The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input... 阅读全文

posted @ 2015-08-09 19:27 张大大123 阅读(184) 评论(0) 推荐(0) 编辑

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 109 下一页

导航