haohonglong / notes Goto Github PK
View Code? Open in Web Editor NEWthe notes that is important for me
the notes that is important for me
netstat -an | grep -i list
gitpod
cloudstudio
集群负载均衡部署
http://nginx.org/en/docs/http/load_balancing.html
http {
upstream server_group_name {
# ip_hash; # 启用ip_hash策略
# last_conn; #启用最少连接策略
server localhost:8080 weight=2 max_fails=3 fail_timeout=15 max_conns=1000; # weight 默认为1.weight越大,负载的权重就越大。使用weight设置权重为20%
server localhost:8081 backup; # 设置为备用机,当其他服务器全部宕机时,启用备用服务器
server localhost:8082 down; # 设置服务器为不可用状态
}
server {
listen 80;
location / {
proxy_pass http://server_group_name;
}
}
}
“char* 并不完全代表字符串。 char* 只能被调用,无法被修改。 而char [] 可以被调用与修改。
#include 只做用指定的文件,替换掉当前的这个#include
=====================================================================
#include 只做一件事情,命令告诉预处理器将指定头文件的内容插入到预处理器命令的相应位置。有两种方式可以指定插入头文件:
#include <文件名>
#include "文件名"
如果需要包含标准库头文件或者实现版本所提供的头文件,应该使用第一种格式。如下例所示:
#include <math.h> // 一些数学函数的原型,以及相关的类型和宏
如果需要包含针对程序所开发的源文件,则应该使用第二种格式。采用 #include 命令所插入的文件,通常文件扩展名是 .h,文件包括函数原型、宏定义和类型定义。只要使用 #include 命令,这些定义就可被任何源文件使用。如下例所示:
#include "myproject.h" // 用在当前项目中的函数原型、类型定义和宏
你可以在 #include 命令中使用宏。如果使用宏,该宏的取代结果必须确保生成正确的 #include 命令。例 1 展示了这样的 #include 命令。
【例1】在 #include 命令中的宏
#ifdef DEBUG
#define MY_HEADER "myProject_dbg.h"
#else
#define MY_HEADER "myProject.h"
#endif
#include MY_HEADER
当上述程序代码进入预处理时,如果 DEBUG 宏已被定义,那么预处理器会插入 myProject_dbg.h 的内容;如果还没定义,则插入 myProject.h 的内容。
预处理器如何找到头文件
由给定的 C 语言实现版本决定 #include 命令所指定文件的搜索路径。同时,也由实现版本决定文件名是否区分大小写。对于命令中使用尖括号指定的文件(<文件名>),预处理器通常会在特定的系统路径下搜索,例如,在 Unix 系统中,会搜索路径 /usr/local/include 与 /usr/include。
对于命令中用双引号指定的文件("文件名"),预处理器通常首先在当前目录下寻找,也就是包含该程序其他源文件的目录。如果在当前目录下没有找到,那么预处理器也会搜索系统的 include 路径。文件名中可以包含路径。但如果文件名中包含了路径,则预处理器只会到该目录下寻找。
你也可以通过使用编译器命令行选项,或在环境变量(该变量通常称为 INCLUDE)中加入搜索路径,为 #include 命令指定自己的搜索路径。具体的做法请参考采用的编译器的说明文档。
嵌套的 #include 命令
#include 命令可以嵌套使用;也就是说,通过 #include 命令插入的源文件本身也可以包含另一个 #include 命令。预处理器最多允许 15 层的嵌套包含。
因为头文件有时候会包含另一个头文件,很容易发生相同的一个文件被多次包含的情况。例如,假设文件 myProject.h 中包含如下代码:
#include <stdio.h>
如果源文件包含下面的 #include 命令,就会两次包含 stdio.h,一次是直接包含,另一次是间接包含:
#include <stdio.h>
#include "myProject.h"
然而,可以采用条件式编译的命令,方便地避免多次包含相同的文件。例 2 使用了这个技巧。
【例2】避免多次包含
#ifndef INCFILE_H_
#define INCFILE_H_
/* ...实际的头文件incfile.h的内容写在这里... /
#endif / INCFILE_H_ */
第一次出现包含 incfile.h 的命令时,INCFILE_H_ 宏是没有定义的。预处理器因此插入 #ifndef 和 #endif 之间的内容,这段内容包含了对 INCFILE_H_ 宏的定义。嵌入 incfile.h 文件之后,#ifndef 条件就会为 false,预处理器会忽略 #ifndef 和 #endif 之间的内容。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.