本文目录 前言 一、顺序结构 二、选择结构1-if语句 三、选择结构2-switch语句 前言 1.默认的运行流程 默认情况下,程序的运行流程是这样的:运行程序后,系统会按书写顺序执行程序中的每一行代码 10 return 0; 11 } 程序运行后,会按顺序执行第6、7、8行语句,于是输出结果为: Hello-1 Hello-2 Hello-3 2.其他运行流程 但很多时候,我们并不想要按照默认的运行流程去走 要想实现这种功能,那就要学会如何去控制程序的运行流程。 3.流程结构 为了方便我们控制程序的运行流程,C语言提供3种流程结构,不同的流程结构可以实现不同的运行流程。 这3种流程结构分别是: 顺序结构:默认的流程结构。按照书写顺序执行每一条语句。 选择结构:对给定的条件进行判断,再根据判断结果来决定执行哪一段代码。 执行到第7行的时候,a<9也是成立的,因此会执行第9行代码。
目录 概述 1、一对多 2、多对多 3、一对一 多表查询概述 多表查询分类 1、连接查询 2、子查询 ---- 概述 项目开发中,在进行数据库表结构关系设计时,会根据业务需求及业务模块之间的关系,分析设计表结构 ,1,2),(null,1,3),(null,2,2),(null,2,3),(null,3,4); ---- 3、一对一 案例:用户与用户详情的关系 关系:一对一关系,多用于单表拆分,,将一张表的基础字段放在一张表中 杭州市第一小学','杭州市第一中学','杭州师范大学',3), (null,'本科','应用数学','阳泉第一小学','阳泉区第一中学','清华大学' ,4); ---- 多表查询概述 概述:指从多张表中查询数据 解决方案 select * from emp,dept where emp.dept_id = dept.id; ---- 多表查询分类 1、连接查询 内连接:相当于查询A、B交集的部分数据 外连接:左外连接:查询左表所有数据,以及俩张表交集部分的数据 右外连接:查询右表所有数据,以及俩张表交集部分的数据 自连接:当前表与自身表的连接查询
添加 Redis Server Group 准备配置文件 [root@h102 codis]# grep -v "^#" extern/redis-2.8.21/redis.conf | grep -v "^$" > /etc/codis/redis_s.conf [root@h102 codis]# grep -v "^#" extern/redis-2.8.21/redis.conf | grep -v "^$" > /etc/codis/redis2.conf [root@h102 codis
randrepeat=boolForrandomIOworkloads,seedthegeneratorinapredictablewaysothatresultsarerepeatableacrossrepetitions.Defaultstotrue.randseed=intSeedtherandomnumbergeneratorsbasedonthisseedvalue,tobeabletocontrolwhatsequenceofoutputisbeinggenerated.Ifnotset,therandomsequencedependsontherandrepeatsetting.fallocate=strWhetherpre-allocationisperformedwhenlayingdownfiles.Acceptedvaluesare:noneDonotpre-allocatespaceposixPre-allocateviaposix_fallocate()keepPre-allocateviafallocate()withFALLOC_FL_KEEP_SIZEset0Backward-compatiblealiasfor'none'1Backward-compatiblealiasfor'posix'Maynotbeavailableonallsupportedplatforms.'keep'isonlyavailableonLinux.IfusingZFSonSolaristhismustbesetto'none'becauseZFSdoesn't support it. Default: 'posix'. fadvise_hint=bool By default, fio will use fadvise() to advise the kernel on what IO patterns it is likely to issue. Sometimes you want to test specific IO patterns without telling the kernel about it, in which case you can disable this option. If set, fio will use POSIX_FADV_SEQUENTIAL for sequential IO and POSIX_FADV_RANDOM for random IO. fadvise_stream=int Notify the kernel what write stream ID to place these writes under. Only supported on Linux. Note, this option may change going forward. size=int The total size of file io for this job. Fio will run until this many bytes has been transferred, unless runtime is limited by other options (such as 'runtime', for instance, or increased/decreased by 'io_size'). Unless specific nrfiles and filesize options are given, fio will divide this size between the available files specified by the job. If not set, fio will use the full size of the given files or devices. If the files do not exist, size must be given. It is also possible to give size as a percentage between 1 and 100. If size=20% is given, fio will use 20% of the full size of the given files or devices. io_size=int io_limit=int Normally fio operates within the region set by 'size', which means that the 'size' option sets both the region and size of IO to
解决方法 : 安装 pcre.x86_64 和 pcre-devel.x86_64 软件包
stats查看状态statsSTAT pid 8917STAT uptime 1183STAT time 1442996635STAT version 1.4.24STAT libevent 1.4.13-stableSTAT pointer_size 64STAT rusage_user 0.014997STAT rusage_system 0.105983STAT curr_connections 12STAT total_connections 14STAT connection_structures
分离数据库 无法分离 main 和 temp 数据库 sqlite> .databases seq name file /usr/local/sqlite3.11/bin/test.db sqlite> Tip: 可以使用 attach 的方法来创建数据库别名
打开本地的 tcp udp 5000端口 标记类型为 syslog filter中作判断如果类型是 syslog 拆分解析信息 添加 received_at received_from 字段 使用 syslog_pri { } 来处理 定义 syslog_timestamp 的格式 输出到ES 以 rubydebug 的格式输出到终端 启动 Logstash [root@h102 etc]# /opt/logstash/bin/logstash -f logstash-syslog.conf Setti
刷新目录过期时间 [root@docker ~]# date +%s ;curl http://127.0.0.1:2379/v2/keys/testdir -XPUT -d ttl=10 -d dir=true 1454394195 {"action":"set","node":{"key":"/testdir","dir":true,"expiration":"2016-02-02T06:23:25.962070512Z","ttl":10,"modifiedIndex":85,"createdInde
upstream 是nginx 负载均衡的主要模块,它提供了一个简单方法来轮询后端的服务器
error: /root/unrealircd/conf/unrealircd.conf:378: set::cloak-keys: (key 2) Keys should be mixed a-zA-Z0-9, error: /root/unrealircd/conf/unrealircd.conf:379: set::cloak-keys: (key 3) Keys should be mixed a-zA-Z0-9, IRCd configuration failed to pass testing 分别为: 1.要求修改操作员角色的用户名和密码 2.cloak-keys 必须得相互不一样,并且由 a-zA-Z0-9
日志信息 =INFO REPORT==== 23-Oct-2015::16:52:50 === Starting RabbitMQ 3.5.6 on Erlang R14B04 Copyright (C) 2007-2015 Pivotal Software, Inc. Licensed under the MPL. See http://www.rabbitmq.com/ =INFO REPORT==== 23-Oct-2015::16:52:50 === node : rabbi
我们还可以使用 DNS API 结合 tag 来过滤服务 [root@h104 ~]# dig @127.0.0.1 -p 8600 rails.web.service.consul ; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.1 <<>> @127.0.0.1 -p 8600 rails.web.service.consul ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<
启动 查看配置 [root@h102 conf]# grep -v "#" /usr/local/nginx/conf/nginx.conf | grep -v "^$" worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on;
可见 docker.service 是依赖于 docker.socket 的,但是并不必要开启
启动haproxy [root@h102 ~]# /usr/local/haproxy/sbin/haproxy -f /etc/haproxy/transparent_proxy.cfg ... ... ... ---------- [root@h102 ~]# netstat -ant | grep 1234 tcp 0 0 0.0.0.0:1234 0.0.0.0:* LISTEN [root@h1
redo 再次执行之前命令 Tip: 历史命令的保持是在当前会话中,不论此时是否已经成功连接服务 [zk: localhost:2181(CONNECTED) 20] history 10 - ls 11 - ls / 12 - create /test test 13 - get /test 14 - ls / 15 - close 16 - ls / 17 - connect localhost:2181 18 - ls / 19 - help 20 - history [zk: localhos
本片文章的主要内容如下: 1、整体流程简介 2、流程详解 3、总结 4、okHttp+Retrofit的整体架构 一、Retrofit整体流程简介 其实整个Retrofit的流程如下图: ? 的CallAdapterFactory;一个是用来进行响应数据转化(反序列化)的ConvertFactory;这两个都可以用户自己进行添加。 方法的返回值为Call<List<Contributor>>,其中Contributor是定义的一个JavaBean类,即业务所需要的数据格式。 流程.png (1)说下整体流程成,运用动态代理技术获取了一个GitHubService的一个实例。 简易的流程图如下: ?
四、循环结构1-while循环 假如要你在屏幕上重复输出10次Hello World,你会怎么做?简单,把下面的代码拷贝10份就行了。 1 printf("Hello World\n"); 没错,把上次代码写10遍,确实能实现功能。但是这样的代码太垃圾了,有很多的重复的代码,这样会使得代码非常地臃肿,复用率低。因此,不建议这么做。 下次遇到像上面那样重复执行某个操作时,首先要想到的应该是循环结构。所谓循环,就是重复执行某一个操作,C语言中有多种方式可以实现循环结构。先来看看while循环。 1.形式 1 while ( 条件 )
struct #include <stdio.h> int main() { struct Contacts { char name[100]; int age; char mobile[12]; }; struct Contacts person1 = {"John", 30, }; printf("name: %s, age: %d, mobile: %s\n", person1.name, person1.age, p