auto

html中页面布局—浮动

旧城冷巷雨未停 提交于 2020-01-31 20:30:17
folat:浮动 none:不浮动,默认 left:向左浮动 right:向右浮动 auto:根据自身所占位置,自动居中 1)、自身必须有宽高 2)、inline-block或folat都会使auto失效 3)、需要填写具体值来调整元素位置 浮动产生的影响: 1)、自身的父元素无法获取宽高 2)、后续的元素会自动补位 3)、浮动会脱离当前文档流,覆盖标准流的元素 4)、auto会失效 5)、块元素可以横排显示(失去独占一行的特性) 6)、行元素可以设置宽和高 7)、除了auto以外,依然支持margin 8)、提升了半个层级z-index(后续会讲到) 使用浮动布局,那么一定要清除浮动,否则会很严重!!!页面会爆炸!! 清除浮动的常见方法有以下几种: 1)、给父级设置宽高 缺点:父级如果作为容器,直接写死了,后续元素添加会出现问题,而且无法解决元素重叠的问题 2)、使用overflow:hidden属性(超出内容区域的部分,隐藏)给父元素添加 缺点:如果内容需要超出,或者较多时,需求发生冲突;如果内容没有超出,推荐使用,较为方便 使用场景:浮动元素较少时 <div id="main" style="overflow: hidden;"> <div class="box1"></div> <div class="box2"></div> <div class="box3"></div

c++字符字面值常量

喜夏-厌秋 提交于 2020-01-31 04:55:18
c++字符字面值常量 // by 鸟哥 qq1833183060 字符字面量 # include <iostream> # include <string> # include <cstdlib> # include <iomanip> void printCode ( auto c ) { int len = sizeof ( c ) ; std :: cout << std :: hex ; std :: cout << "code:" ; unsigned char * p = ( unsigned char * ) & c ; for ( int i = 0 ; i < len ; i ++ ) { unsigned char code = * ( p + i ) ; if ( code == 0 ) { std :: cout << std :: setfill ( '0' ) << std :: setw ( 2 ) << "0" << " " ; } else { std :: cout << std :: setfill ( '0' ) << std :: setw ( 2 ) << ( int ) code << " " ; } } std :: cout << std :: endl ; } int main ( ) { auto a = 'a' ; /

kafka-0.9消费者新API

我们两清 提交于 2020-01-28 07:53:08
## kafka-0.9消费者新API 注:以下仅限kafka版本0.9以上Consumer新版api Consumer自动提交示例: Properties props = new Properties(); props.put("bootstrap.servers", kafkaBrokerURL); props.put("group.id", groupId); props.put("enable.auto.commit", "true"); props.put("auto.commit.interval.ms", "1000"); props.put("session.timeout.ms", "30000"); props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("auto.offset.reset", "earliest"); KafkaConsumer<String, String> consumer = new KafkaConsumer

深入应用C++11(第一章)——auto,decltype,using,默认模板参数

大憨熊 提交于 2020-01-28 02:20:53
类型推导 auto auto只是一个类型声明的“占位符”, 通过变量的初始化表达式推导出变量具有的类型 使用auto声明的变量必须马上初始化,在编译时将auto替换为真正的类型 // auto auto x = 5; // int auto pi = new auto(1); // pi被推导为*int const auto* v = &x, u = 6; // v:const int * ,u:const int (u必须初始化为一个int,不然推导产生二义性) static auto y = 0.0; // double // auto只能是一个类型声明的“占位符” // 使用auto声明的变量必须马上初始化,在编译时将auto替换为真正的类型 // auto s; 当不声明为指针或引用时 推导结果 = 初始化表达式抛弃引用和抛弃cv限定符后结果 当声明为指针或引用时 推导结果 = 初始化表达式的cv限定符 int x = 0; auto *a = &x; // a -> int* auto -> int auto b = &x; // b -> int* auto -> int* auto &c = x; // c -> int& auto -> int auto d = c; // d -> int auto -> int 抛弃引用类型 const auto e = x;

springboot手动提交kafka offset

断了今生、忘了曾经 提交于 2020-01-24 17:13:42
转载自 springboot手动提交kafka offset enable.auto.commit参数设置成了false 但是测试发现enable.auto.commit参数设置成了false,kafka的offset依然提交了(也没有进行人工提交offset)。 查看源码 如果我们enable.auto.commit设置为false,那么就会走标红的if语句。而且下面有个stopInvokerAndCommitManualAcks()方法,看名字就知道是人工提交的意思。那么我们进去stopInvokerAndCommitManualAcks()方法瞅瞅。 如上图所示有个processCommits()方法,那么继续追进去: 单单看标红的方法是不是就知道这方法里面是更新offset和提交offset的方法。那么我们继续追进去: 结论:如果我们把enable.auto.commit参数设置成true。那么offset交给kafka来管理,offset进行默认的提交模式。 enable.auto.commit参数设置成false。那么就是Spring来替为我们做人工提交,从而简化了人工提交的方式。 所以kafka和springboot结合中的enable.auto.commit为false为spring的人工提交模式。enable.auto

Can the types of parameters in template functions be inferred?

时光毁灭记忆、已成空白 提交于 2020-01-24 10:47:04
问题 I'm writing some template functions in C++, but I'm not sure if it's possible to define a template function that infers the types of its parameters. I tried to define a template with inferred parameter types, but this example won't compile: template <auto> auto print_stuff(auto x, auto y) { std::cout << x << std::endl; std::cout << y << std::endl; } It works when I give a unique name to each parameter type, but this seems somewhat redundant: #include <iostream> #include <string> template

auto, decltype(auto) and trailing return type

风格不统一 提交于 2020-01-23 11:06:32
问题 Is there a difference between: template <class T> constexpr decltype(auto) f(T&& x) -> decltype(std::get<0>(std::forward<T>(x))) { return std::get<0>(std::forward<T>(x)); } and: template <class T> constexpr auto f(T&& x) -> decltype(std::get<0>(std::forward<T>(x))) { return std::get<0>(std::forward<T>(x)); } and if so, what is it, and which one should I use for perfect forwarding? 回答1: Trailing return type should only be used with auto The point of decltype(auto) vs auto is to distinguish the

Is it valid to do explicit template specialisation with auto return 'type' in C++14?

倖福魔咒の 提交于 2020-01-23 07:26:13
问题 Previous question. I repeat the code from the previous question to make this question self-contained. The code below compiles and does not issue any warnings if it is compiled using gcc 4.8.3. with -std=c++1y . However, it does issue warnings if compiled with -std=c++0x flag. In the context of the previous question it was stated that the code does not compile using gcc 4.9.0. Unfortunately, at present, I do not fully understand how auto is implemented. Thus, I would appreciate if anyone could

C++ string基本操作

匆匆过客 提交于 2020-01-22 17:58:43
初始化 //string 类型的初始化方法 string s1; string s2 = s1; string s3 = "lol"; string s4("JarvenIV"); string s5(7,'7'); //连续n个字符组成的串 读写 string s; cin>>s; cout<<s; 范围for语句 //c++范围for语句,处理字符串中的每个字符 //将字符串中的每个小写字母转换为大写字母 string str("I can fly high!"); for(auto &c : str) //使用引用以更改字符的值 c = toupper(c); cout<<str<<endl; //统计字符串中的数字个数 string s("clear4396love"); decltype(s.size()) digit_count = 0;//decltype函数返回s.size()的类型 for(auto c : s) if(isdigit(c)) //该字符是数字 ++digit_count; cout<<digit_count; 迭代器操作 //string::const_iterator 为指向常量的迭代器类型 //string::iterator 为迭代器类型 string s("HelloWorld!"); //使用begin(),end()方法修改 for

006.前端开发知识,前端基础CSS(2020-01-21)

亡梦爱人 提交于 2020-01-21 16:07:39
来源:第五天 01盒子水平居中 一、盒子中文字控制:   1.text-align: center; /*可以让盒子内容(文字 行内元素 行内块元素)居中对齐*/ 二、让盒子水平居中对齐:   方法1. margin: 0 auto; /* 通俗写法 0 auto 上下是 0 左右是auto 水平居中对齐 */   方法2. margin-left: auto; margin-right: auto; /*自动充满*/   方法 3.margin: auto; /* 上下左右都是auto*/ 来源:第五天 02外边距合并 一、css初始化 body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, th, td { margin:0; padding:0; } body { font-size:12px; color:#666; font-family:Verdana, Microsoft YaHei, Simsun; background:#fff; line-height:24px; } fieldset, img { border:0; } ol, ul { list-style:none; } h1, h2, h3, h4, h5,