通过大众点评平台开发来简单了解一下,oc的网络编程和数据解析(json)

首先我们需要到大大众点评开发者平台申请一个key。http://developer.dianping.com/app/tech/api这个网站有api文档。

本文没有使用第三方库,网络其请求使用NSURLConnection类,json数据解析使用NSJSONSerialization。这个例子是根据条件获取商户信息。

1.定义常量

#define kSearchResto @"v1/business/find_businesses"

#define kDPDomain @"http://api.dianping.com/"

#define kDPAppKey @"。。。"

#define kDPAppSecret @"。。。"

#define kWFRequestimeOutInterval 60.0

#define kHttpMethodGET @"GET"

#define kHttpMethodPOST @"POST"

2.创建数据类,包含商户信息

//
// WFBusiness.h
// WFSearch
//
// Created by ForrestWoo on 14-9-5.
// Copyright (c) 2014年 ForrestWoo. All rights reserved.
// #import <Foundation/Foundation.h> #import "WFRootModel.h" @interface WFBusiness : WFRootModel @property (nonatomic, assign) int business_id;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *branch_name;
@property (nonatomic, strong) NSString *address;
@property (nonatomic, strong) NSString *telephone;
@property (nonatomic, strong) NSString *city;
//星级图片链接。
@property (nonatomic, strong) NSString *rating_img_url;
@property (nonatomic, strong) NSString *rating_s_img_url;
@property (nonatomic, strong) NSArray *regions;
@property (nonatomic, strong) NSArray *categories; //经纬度信息
@property (nonatomic, assign) float latitude;
@property (nonatomic, assign) float longitude;
@property (nonatomic, assign) float avg_rating;
@property (nonatomic, assign) float product_score;
@property (nonatomic, assign) float decoration_score;
@property (nonatomic, assign) float service_score; //评价 分五种。1:一般,2:尚可,3:好,4:很好,5:非常好
@property (nonatomic, assign) int product_grade;
@property (nonatomic, assign) int decoration_grade;
@property (nonatomic, assign) int service_grade; //人均消费。
@property (nonatomic, assign) int avg_price;
//点评。
@property (nonatomic, assign) int review_count;
@property (nonatomic, strong) NSArray *review_list_url;
@property (nonatomic, assign) int distance;
@property (nonatomic, strong) NSString *business_url; //图片
@property (nonatomic, strong) NSString *photo_url;
@property (nonatomic, strong) NSString *s_photo_url;
@property (nonatomic, assign) int photo_count;
@property (nonatomic, strong) NSArray *photo_list_url; //优惠券。
@property (nonatomic, assign) int has_coupon;
@property (nonatomic, assign) int coupon_id;
@property (nonatomic, strong) NSString *coupon_description;
@property (nonatomic, strong) NSString *coupon_url; //团购信息。
@property (nonatomic, assign) int has_deal;
@property (nonatomic, assign) int deal_count;
@property (nonatomic, strong) NSArray *deals;
@property (nonatomic, strong) NSString *deals_id;
@property (nonatomic, strong) NSString *deals_description;
@property (nonatomic, strong) NSString *deals_url;
@property (nonatomic, assign) int has_online_reservation;
@property (nonatomic, strong) NSString *online_reservation_url; - (id)initWithJson:(NSDictionary *)jsonData; @end

这里的属性名字并不是随便定义的,而是根据服务器端返回的字段名称定义的,它与返回的名称是一致的,目的是方便以后通过反射对类的属性赋值,这样我们不需要一一赋值,详情请继续

3.WFRootModel

#import <Foundation/Foundation.h>

//根类,定义一些通用的属性和消息
@interface WFRootModel : NSObject //获取类的属性名称,以通过反射对对象的属性赋值。
- (NSArray *)PropertyKeys; @end #import "WFRootModel.h"
#import <objc/runtime.h> @implementation WFRootModel - (NSArray *)PropertyKeys
{
unsigned int outCount,i;
objc_property_t *pp = class_copyPropertyList([self class], &outCount);
NSMutableArray *keys = [[NSMutableArray alloc] initWithCapacity:0];
for (i = 0; i < outCount; i++)
{
objc_property_t property = pp[i];
NSString *propertyName = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding];
[keys addObject:propertyName];
} return keys;
} @end

  此类赋予了它的子类一个重要行为,它只包含一个消息[- (NSArray *)PropertyKeys],它的作用是子类能够获取自己包含的所有属性。反射中会使用这些属性。

4.创建请求url

  大众点评请求使用SHA加密。

[1]SHA加密类SHA1,需要引入

CommonDigest.h
@interface SHA1 : NSObject

+ (NSString *)getSHAString:(NSData *)aStringbytes;

@end

#import <CommonCrypto/CommonDigest.h>

#import "SHA1.h"

@implementation SHA1

+ (NSString *)getSHAString:(NSData *)aStringbytes
{
unsigned char digest[CC_SHA1_DIGEST_LENGTH]; if (CC_SHA1([aStringbytes bytes], [aStringbytes length], digest))
{
NSMutableString *digestString = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH];
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
{
unsigned char aChar = digest[i];
[digestString appendFormat:@"%02x",aChar];
}
return digestString;
}
else
{
return nil;
}
} @end

由于我对加密了解很少,所以就不做介绍了,只给出一个方法,供大家参考。

[2]返回根url,因为根url会常用到,我们就将它封装起来,以便后用

- (NSString *)getRootURL
{
return kDPDomain;
}

[3]返回合法的url

- (NSString *)serializeURL:(NSString *)aBaseURL params:(NSDictionary *)aParams
{
NSURL* parsedURL = [NSURL URLWithString:[aBaseURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableDictionary *paramsDic = [NSMutableDictionary dictionaryWithDictionary:[self parseQueryString:[parsedURL query]]];
if (aParams) {
[paramsDic setValuesForKeysWithDictionary:aParams];
} NSMutableString *signString = [NSMutableString stringWithString:kDPAppKey];
NSMutableString *paramsString = [NSMutableString stringWithFormat:@"appkey=%@", kDPAppKey];
NSArray *sortedKeys = [[paramsDic allKeys] sortedArrayUsingSelector: @selector(compare:)];
for (NSString *key in sortedKeys) {
[signString appendFormat:@"%@%@", key, [paramsDic objectForKey:key]];
[paramsString appendFormat:@"&%@=%@", key, [paramsDic objectForKey:key]];
}
NSString *str = kDPAppSecret;
[signString appendString:str];
NSData *stringBytes = [signString dataUsingEncoding: NSUTF8StringEncoding];
NSString *digestString = [SHA1 getSHAString:stringBytes];
if (digestString)
{
[paramsString appendFormat:@"&sign=%@", [digestString uppercaseString]];
NSLog(@"...%@...", [NSString stringWithFormat:@"%@://%@%@?%@", [parsedURL scheme], [parsedURL host], [parsedURL path], [paramsString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]);
return [NSString stringWithFormat:@"%@://%@%@?%@", [parsedURL scheme], [parsedURL host], [parsedURL path], [paramsString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}
else
{
return nil;
}
}

5.创建网络连接,发送请求

使用NSURLConnection来完成网络连接

- (void)createConnectionWithUrl:(NSString *)urlString params:(NSDictionary *)aParams delegate:(id<WFRequestDelegate>)aDelegate
{
NSString *urlStr = [self serializeURL:[self generateFullURL:urlString] params:aParams];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlStr] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:kWFRequestimeOutInterval]; [request setHTTPMethod:kHttpMethodGET];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
self.delegate = aDelegate;
// [[[self class] sharedInstance] setConnections:conn];
}

6.返回结果以及数据解析

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
_responseData = [[NSMutableData alloc] init];
} - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[_responseData appendData:data];
} - (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *error = nil;
id result= [NSJSONSerialization JSONObjectWithData:_responseData options:NSJSONReadingAllowFragments error:&error];
if (!result)
{
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:error,@"error", nil];
NSError *err = [NSError errorWithDomain:@"domain is error" code:-1 userInfo:userInfo];
if ([self.delegate respondsToSelector:@selector(request:didfailWithError:)])
{
[self.delegate request:self didfailWithError:err];
}
}
else
{
NSString *status = 0;
if ([result isKindOfClass:[NSDictionary class]])
{
status = [result objectForKey:@"status"];
} if ([status isEqualToString:@"OK"])
{
if ([self.delegate respondsToSelector:@selector(request:didfinishloadingWithResult:)])
{
[self.delegate request:self didfinishloadingWithResult:result == nil ?
_responseData : result];
}
}
else
{
if ([status isEqualToString:@"ERROR"])
{
//TODO:错误处理代码。
}
}
} // NSString *str = [[NSString alloc] initWithData:_responseData encoding:NSUTF8StringEncoding];
// NSLog(@"_responseData:%@", str); // [self clearData];
} - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"ERROR!%@", error.description);
}

返回的数据存储在一个WFFindBusinessesResult的实例中。

//super class for result.
@interface WFUrlResult : NSObject @property (nonatomic, strong) NSString *status;
@property (nonatomic, assign) NSInteger total_count;
@property (nonatomic, assign) NSInteger count; - (id)initWithJson:(NSDictionary *)jsonData; @end @interface WFFindBusinessesResult : WFUrlResult @property (nonatomic, strong) NSArray *businesses; @end

对对象赋值非常简单

@implementation WFFindBusinessesResult

- (id)initWithJson:(NSDictionary *)jsonData
{ self.status = [jsonData objectForKey:@"status"];
self.count = [[jsonData objectForKey:@"count"] integerValue];
self.total_count = [[jsonData objectForKey:@"total_count"] integerValue];
NSArray *arr = nil;
NSMutableArray *businessArr = [[NSMutableArray alloc] initWithCapacity:0]; if ([jsonData isKindOfClass:[NSDictionary class]])
{
arr = [jsonData objectForKey:@"businesses"];
    //赋值,通过反射赋值,根本不需要一一对字段赋值。
for (id obj in arr)
{
WFBusiness *bus = [[WFBusiness alloc] init];
NSArray *propertyList = [[[WFBusiness alloc] init] PropertyKeys];
for (NSString *key in propertyList)
{ [bus setValue:[obj objectForKey:key] forKey:key];
}
[businessArr addObject:bus];
NSLog(@"photo is %@", [bus categories]);
} }
NSLog(@"businessArr count is %lu", [businessArr count]);
self.Businesses = businessArr;
return self;
} @end

完整的封装类WFHTTPRequest。它用于创建一个连接,并发送请求,管理整个应用出现的网络连接,创建一个单例,全局唯一。

//
// WFRequest.h
// WFSearch
//
// Created by ForrestWoo on 14-8-30.
// Copyright (c) 2014年 ForrestWoo. All rights reserved.
// #import <Foundation/Foundation.h> @class WFHTTPRequest;
@protocol WFRequestDelegate <NSObject> @optional
- (void)request:(WFHTTPRequest *)request didfinishloadingWithResult:(id)aResult;
- (void)request:(WFHTTPRequest *)request didfailWithError:(NSError *)aError; @end @interface WFHTTPRequest : NSObject @property (nonatomic, unsafe_unretained) id<WFRequestDelegate> delegate;
@property (nonatomic, strong) NSString *aUrl;
@property (nonatomic, strong) NSDictionary *aParams;
@property (nonatomic, strong) NSArray *connections; + (WFHTTPRequest *)sharedInstance; - (void)createConnectionWithUrl:(NSString *)urlString params:(NSDictionary *)aParams delegate:(id<WFRequestDelegate>)aDelegate; - (void) cancel;
- (NSString *)getRootURL; //api - (void)findBusinessesWithParams:(NSDictionary *)aParams delegate:(id<WFRequestDelegate>)aDelegate;
- (void)findCityWithDelegate:(id<WFRequestDelegate>)aDelegate;
- (void)getCategoriesForBusinessesWithDelegate:(id<WFRequestDelegate>)aDelegate; @end
//
// WFRequest.m
// WFSearch
//
// Created by ForrestWoo on 14-8-30.
// Copyright (c) 2014年 ForrestWoo. All rights reserved.
// #import "WFHTTPRequest.h"
#import "WFConstants.h"
#import "SHA1.h" @interface WFHTTPRequest () <NSURLConnectionDataDelegate> //- (void)appendUTF8Body:(NSMutableData *)aBody dataString:(NSString *)aDataString;
//- (NSDictionary *)parseQueryString:(NSString *)query;
////- (void)handleResponseData:(NSData *)data;
//- (NSString *)generateFullURL:(NSString *)url;
////- (void)addConnection;
//- (NSString *)serializeURL:(NSString *)aBaseURL params:(NSDictionary *)aParams; @end static WFHTTPRequest *sharedObj = nil; @implementation WFHTTPRequest
{
NSURLConnection *_connection;
NSMutableData *_responseData;
} - (NSString *)getRootURL
{
return kDPDomain;
} - (NSString *)generateFullURL:(NSString *)url
{
NSMutableString *str = [[NSMutableString alloc] initWithCapacity:0]; [str appendString:[self getRootURL]];
[str appendString:url];
return str;
} + (WFHTTPRequest *)sharedInstance
{
static dispatch_once_t pred = 0; dispatch_once(&pred, ^{
sharedObj = [[super allocWithZone:NULL] init];
}); return sharedObj;
} + (id)allocWithZone:(struct _NSZone *)zone
{
return [self sharedInstance];
} - (void)createConnectionWithUrl:(NSString *)urlString params:(NSDictionary *)aParams delegate:(id<WFRequestDelegate>)aDelegate
{
NSString *urlStr = [self serializeURL:[self generateFullURL:urlString] params:aParams];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlStr] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:kWFRequestimeOutInterval]; [request setHTTPMethod:kHttpMethodGET];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
self.delegate = aDelegate;
// [[[self class] sharedInstance] setConnections:conn];
} - (void)findBusinessesWithParams:(NSDictionary *)aParams delegate:(id<WFRequestDelegate>)aDelegate
{
[self createConnectionWithUrl:kSearchResto params:aParams delegate:aDelegate];
} - (void)findCityWithDelegate:(id<WFRequestDelegate>)aDelegate
{
[self createConnectionWithUrl:kSearchCity params:nil delegate:aDelegate];
} - (void)getCategoriesForBusinessesWithDelegate:(id<WFRequestDelegate>)aDelegate
{
[self createConnectionWithUrl:kCategoriesWithBusinesses params:nil delegate:aDelegate];
} //- (void)appendUTF8Body:(NSMutableData *)aBody dataString:(NSString *)aDataString
//{
// [aBody appendData:[aDataString dataUsingEncoding:NSUTF8StringEncoding]];
//} - (NSDictionary *)parseQueryString:(NSString *)query
{
NSMutableDictionary *paramDict = [[NSMutableDictionary alloc] initWithDictionary:0]; NSArray *paramArr = [query componentsSeparatedByString:@"&"];
for (NSString *param in paramArr)
{
NSArray * elements = [param componentsSeparatedByString:@"="];
if ([elements count] <= 1)
{
return nil;
} NSString *key = [[elements objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *value = [[elements objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [paramDict setObject:value forKey:key];
} return paramDict;
} - (NSString *)serializeURL:(NSString *)aBaseURL params:(NSDictionary *)aParams
{
NSURL* parsedURL = [NSURL URLWithString:[aBaseURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableDictionary *paramsDic = [NSMutableDictionary dictionaryWithDictionary:[self parseQueryString:[parsedURL query]]];
if (aParams) {
[paramsDic setValuesForKeysWithDictionary:aParams];
} NSMutableString *signString = [NSMutableString stringWithString:kDPAppKey];
NSMutableString *paramsString = [NSMutableString stringWithFormat:@"appkey=%@", kDPAppKey];
NSArray *sortedKeys = [[paramsDic allKeys] sortedArrayUsingSelector: @selector(compare:)];
for (NSString *key in sortedKeys) {
[signString appendFormat:@"%@%@", key, [paramsDic objectForKey:key]];
[paramsString appendFormat:@"&%@=%@", key, [paramsDic objectForKey:key]];
}
NSString *str = kDPAppSecret;
[signString appendString:str];
NSData *stringBytes = [signString dataUsingEncoding: NSUTF8StringEncoding];
NSString *digestString = [SHA1 getSHAString:stringBytes];
if (digestString)
{
[paramsString appendFormat:@"&sign=%@", [digestString uppercaseString]];
NSLog(@"...%@...", [NSString stringWithFormat:@"%@://%@%@?%@", [parsedURL scheme], [parsedURL host], [parsedURL path], [paramsString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]);
return [NSString stringWithFormat:@"%@://%@%@?%@", [parsedURL scheme], [parsedURL host], [parsedURL path], [paramsString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}
else
{
return nil;
}
} - (void) cancel
{
[_connection cancel];
} + (NSString *)getParamValueFromURL:(NSString *)aURl paramName:(NSString *)aParamName
{
return nil;
} #pragma mark - NSURLConnection Delegate Methods - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
_responseData = [[NSMutableData alloc] init];
} - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[_responseData appendData:data];
} - (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *error = nil;
id result= [NSJSONSerialization JSONObjectWithData:_responseData options:NSJSONReadingAllowFragments error:&error];
if (!result)
{
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:error,@"error", nil];
NSError *err = [NSError errorWithDomain:@"domain is error" code:-1 userInfo:userInfo];
if ([self.delegate respondsToSelector:@selector(request:didfailWithError:)])
{
[self.delegate request:self didfailWithError:err];
}
}
else
{
NSString *status = 0;
if ([result isKindOfClass:[NSDictionary class]])
{
status = [result objectForKey:@"status"];
} if ([status isEqualToString:@"OK"])
{
if ([self.delegate respondsToSelector:@selector(request:didfinishloadingWithResult:)])
{
[self.delegate request:self didfinishloadingWithResult:result == nil ?
_responseData : result];
}
}
else
{
if ([status isEqualToString:@"ERROR"])
{
//TODO:错误处理代码。
}
}
} // NSString *str = [[NSString alloc] initWithData:_responseData encoding:NSUTF8StringEncoding];
// NSLog(@"_responseData:%@", str); // [self clearData];
} - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"ERROR!%@", error.description);
} - (void)clearData
{
_responseData = nil;
[_connection cancel];
_connection = nil;
}
@end

代码下载。下节详细介绍数据解析和网络编程,反射(运行时)

初探iOS网络开发,数据解析。的更多相关文章

  1. ios网络_json数据解析

    网络上数据传输以json或者xml格式. json是字典 或者 数组 或者字典跟数组嵌套的形式.解析json就是把json反序列化(解析)---把json转换为oc对象.json序列化就是把oc对象转 ...

  2. Android网络之数据解析----SAX方式解析XML数据

    ​[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/ ...

  3. iOS学习——JSON数据解析(十一)

    在之前的<iOS学习——xml数据解析(九)>介绍了xml数据解析,这一篇简单介绍一下Json数据解析.JSON 即 JavaScript Object Natation,它是一种轻量级的 ...

  4. Android网络之数据解析----使用Google Gson解析Json数据

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...

  5. 【原】iOS学习38网络之数据解析

    1. 解析的基本的概念 解析:从事先规定好的格式中提取数据 解析前提:提前约定好格式,数据提供方按照格式提供数据.数据获取方则按照格式获取数据 iOS开发常见的解析:XML解析.JOSN解析 2. X ...

  6. IOS网络开发概述

    概览 大部分应用程序都或多或少会牵扯到网络开发,例如说新浪微博.微信等,这些应用本身可能采用iOS开发,但是所有的数据支撑都是基于后台网络服务器的.如今,网络编程越来越普遍,孤立的应用通常是没有生命力 ...

  7. iOS网络之数据请求GET和POST

    1. HTTP和HTTPS协议 1> URL URL全称是Uniform Resource Locator(统一资源定位符)通过1个URL,能找到互联网上唯一的1个资源 URL就是资源的地址.位 ...

  8. IOS网络开发(三)

    1 飞机航班查询软件 1.1 问题 NSURLConnection是IOS提供的用于处理Http协议的网络请求的类,可以实现同步请求也可以实现异步请求,本案例使用NSURLConnection类实现一 ...

  9. iOS学习之数据解析

    解析:按照约定好的格式提取数据的过程叫做解析; 后台开发人员按照约定好的格式存入数据,前端开发人员按照约定的格式读取数据; 主流的格式: XML / JSON 前端和后台都能识别的格式;  XML解析 ...

随机推荐

  1. oracle like 条件拼接

    (1) ibatis xml配置:下面的写法只是简单的转义 namelike '%$name$%' (2) 这时会导致sql注入问题,比如参数name传进一个单引号“'”,生成的sql语句会是:nam ...

  2. mysql 阿里内核人员

    丁奇 http://dinglin.javaeye.com/ 鸣嵩 @曹伟-鸣嵩 (新浪微博) 彭立勋 http://www.penglixun.com/ 皓庭 http://wqtn22.iteye ...

  3. Delphi模拟最小化恢复关闭按纽

    https://yq.aliyun.com/wenji/96083 本文讲的是Delphi模拟最小化恢复关闭按纽, 我们做多文档应用程序开发时,如果在主From中指定mainMenu时,在主菜单上右角 ...

  4. ASP.NET Identity系列02,在ASP.NET MVC中增删改查用户

    本篇体验在ASP.NET MVC中使用ASP.NET Identity增删改查用户. 源码在这里:https://github.com/darrenji/UseIdentityCRUDUserInMV ...

  5. android:活动的最佳实践

    2.6.1    知晓当前是在哪一个活动 这个技巧将教会你,如何根据程序当前的界面就能判断出这是哪一个活动.可能你会觉 得挺纳闷的,我自己写的代码怎么会不知道这是哪一个活动呢?很不幸的是,在你真正进入 ...

  6. A股和B股票的区别?

    一.A股和B股的区别——概念不同 (一).A股的概念A股是由中国境内的公司发行,正式名称是人民币普通股票,供境内机构.组织或个人(从4月1日起,境内港.澳.台居民可开立A股账户)以人民币认购和交易的普 ...

  7. Linux学习10-CentOS搭建nginx负载均衡环境

    前言 当自己的web网站访问的人越来越多,一台服务器无法满足现有的业务时,此时会想到多加几台服务器来实现负载均衡. 网站的访问量越来越大,服务器的服务模式也得进行相应的升级,怎样将同一个域名的访问分散 ...

  8. [Android Security] APK自我保护 - DEX/APK校验

    cp : https://segmentfault.com/a/1190000005105973 DEX校验 classes.dex 是 Android 虚拟机的可执行文件,我们所写的 java 代码 ...

  9. 关于GreenPlum的一些整理

    Greenplum数据库架构 Greenplum数据库基本由PostgreSQL核心增强数据库实例组合并衔接成的数据库管理系统,即Greenplum数据在PostgreSQL基础上扩展开发,每个Gre ...

  10. .Net Excel操作之NPOI(一)简介

    一.NPOI简介 NPOI是一个开源项目,可以读/写xls,doc,ppt文件,有着广泛的应用. 使用NPOI能够帮助开发者在没有安装微软Office的情况下读写Office 97-2003的文件,支 ...