摘要:做网站时经常会用到remote_addr和x_forwarded_for这两个头信息来获取客户端的IP,然而当有反向代理或者CDN的情况下,这两个值就不够准确了,需要调整一些配置。什么是remote_addrremote_addr代表客户端的IP,但它的值不是由客户端提供的,而是服务端根据客户端的i... 阅读全文
Linux服务器上监控网络带宽命令
2015-04-11 14:41 by youxin, 1279 阅读, 0 推荐, 收藏,
摘要:本文介绍了一些可以用来监控网络使用情况的Linux命令行工具。这些工具可以监控通过网络接口传输的数据,并测量目前哪些数据所传输的速度。入站流量和出站流量分开来显示。一些命令可以显示单个进程所使用的带宽。这样一来,用户很容易发现过度使用网络带宽的某个进程。这些工具使用不同的机制来制作流量报告。nloa... 阅读全文
boost编译很慢的解决方法
2015-04-08 16:10 by youxin, 2121 阅读, 0 推荐, 收藏,
摘要:场景:使用boost库的正则模块时出现编译超慢的情况,看了头文件#include 的引用关系,它依赖的头文件相当多,这应该就是根本原因吧。目前知道可行的方案只有使用预编译头。vs放到stdafx.h后,就编译一次,然后其他需要的地方,会去一个本地的pch文件里.一些。”“VC创建项目时自动创建的预编... 阅读全文
python select poll
2015-04-06 22:32 by youxin, 342 阅读, 0 推荐, 收藏,
摘要:http://www.cnblogs.com/coser/archive/2012/01/06/2315216.html 阅读全文
python SocketServer
2015-04-06 22:07 by youxin, 1553 阅读, 0 推荐, 收藏,
摘要:SocketServer是标准库中一个高级别的模块,用于简化网络客户与服务器的实现。模块中,已经实现了一些可供使用的类。在Python3中,本模块为socketserver模块。在Python 2中,本模块为SocketServer模块。所以在用import导入时,要分情况导入,否则会报错。导入的代... 阅读全文
boost implicit_cast
2015-04-06 18:45 by youxin, 1177 阅读, 1 推荐, 收藏,
摘要:在stackoverflow上看到这个帖子, 于是发现了boost::implicit_cast这个小东西.先来看看这段代码:struct top {};struct mid_a : top {};struct mid_b : top {};struct bottom : mid_a, mid_b ... 阅读全文
函数名 函数名取地址 区别
2015-04-05 20:37 by youxin, 3157 阅读, 0 推荐, 收藏,
摘要:有时看到如下的代码:/*****************************/#include #include #include void test(){ printf("123456\n");} int main(int argc, char *argv[]){ printf(... 阅读全文
STL make_heap push_heap pop_heap sort_heap
2015-04-05 20:32 by youxin, 880 阅读, 0 推荐, 收藏,
摘要:make_heap: default (1) template <class RandomAccessIterator> void make_heap (RandomAccessIterator first, RandomAccessIterator last); custom (2) templa 阅读全文
STL: fill,fill_n,generate,generate_n
2015-04-05 16:32 by youxin, 360 阅读, 0 推荐, 收藏,
摘要:fillAssigns the same new value to every element in a specified range.template void fill( ForwardIterator _First, ForwardIterator _Last, ... 阅读全文
gcc __attribute__
2015-04-05 01:21 by youxin, 626 阅读, 0 推荐, 收藏,
摘要:GNU C的一大特色就是__attribute__机制。__attribute__可以设置函数属性(Function Attribute)、变量属性(Variable Attribute)和类型属性(Type Attribute)。__attribute__书写特征是:__attribute__前后... 阅读全文
浙公网安备 33010602011771号