1.概念Cache-control用于控制HTTP缓存(在HTTP/1.0中可能部分没实现,仅仅实现了Pragma:
no-cache)数据包中的格式:Cache-Control:cache-directivecache-directive可以为以下:request时用到:|
"no-cache"|...
分类:
其他好文 时间:
2014-05-12 16:25:03
阅读次数:
245
在IOS中,所有对象的内存分配的方法都会调用allocWithZone,比如构造函数alloc,所以重写这个方法就可以实现单例。
Xcode中预先写好了实现代码的快捷指令,敲dispatch_once就会看到。这个是有GCD实现的单例代码。实现代码如下:+(id)allocWithZone:(...
分类:
移动开发 时间:
2014-05-05 22:09:11
阅读次数:
392
写了个objectpool,很简单,就是个线程安全的队列。
#pragma once
#include
#include
#include
#include
template
class ObjectPool
{
public:
ObjectPool(size_t chunk_size = kdefault_size, size_t chunk_num = 32)
: chun...
分类:
编程语言 时间:
2014-05-05 13:11:58
阅读次数:
446
题目给了一个满足最大流的残量网络,判断是否费用最小。如果残量网络中存在费用负圈,那么不是最优,在这个圈上增广,增广1的流量就行了。1.SPFA中某个点入队超过n次,说明存在负环,但是这个点不一定在负环上。2.这个负环可能包括汇点t,所以构建残量网络的时候也要考虑防空洞到t上的容量。//#pragma...
分类:
其他好文 时间:
2014-05-03 23:12:12
阅读次数:
377
#pragma once#include namespace stds { class tool
{ public: std::string ws2s(const std::wstring& ws) { std::string curLocale =
setlocale(LC_ALL...
分类:
其他好文 时间:
2014-05-03 22:25:17
阅读次数:
318
Lease 的机制:hdfs支持write-once-read-many,也就是说不支持并行写,那么对读写的互斥同步就是靠Lease实现的。Lease说白了就是一个有时间约束的锁。客户端写文件时需要先申请一个Lease,对应到namenode中的LeaseManager,客户端的client name就作为一个lease的holder,即租约持有者。LeaseManager起什么作用呢?
读写过程的容错是怎么做的?数据块是如何复制的?数据块的恢复机制?本文都有涉及。...
分类:
其他好文 时间:
2014-05-02 23:22:14
阅读次数:
450
裸差分约束。//#pragma comment(linker,
"/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#includ...
分类:
其他好文 时间:
2014-05-02 13:13:29
阅读次数:
290
Problem C: The Dragon of Loowater
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.
The shores of Rellau Creek in central Loowater had always been a prime...
分类:
其他好文 时间:
2014-05-02 10:07:09
阅读次数:
402
1 //自定义Edit,实现十六进制输入控制,使用OnChar()函数实现 2 //MyEdit.h
3 #pragma once 4 5 class CMyEdit : public CEdit { 6 DECLARE_DYNAMIC(CMyEdit)
-------------...
分类:
其他好文 时间:
2014-05-01 21:32:46
阅读次数:
494
dispatch_once的实现分析
dispatch_once可以保证代码被执行一次
+(NSDateFormatter*)getDBDateFormat
{
static NSDateFormatter* format;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
format = [[LKDateFormatter alloc]init];
format.dateF...
分类:
其他好文 时间:
2014-04-30 22:12:40
阅读次数:
336