calc

Not possible to use CSS calc() with transform:translateX in IE

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: All, I would like to be able to use calc() with transform:translateX in my CSS. E.g., #myDiv { -webkit-transform: translateX(calc(100% - 50px)); -moz-transform: translateX(calc(100% - 50px)); transform: translateX(calc(100% - 50px)); } While this works perfectly in Chrome, Safari, and Firefox - it does not work in IE10 or IE11. You can see a simple example here: http://jsfiddle.net/SL2mk/9/ Is this impossible? Is it a bug in IE, or is calc() not supposed to work in this context? For what it's worth - I read here that you can "stack"

Calc of max, or max of calc in CSS

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to do something like this max-width: calc(max(500px, 100% - 80px)) or max-width: max(500px, calc(100% - 80px))) in CSS? 回答1: No you cannot. max() and min() have been dropped from CSS3 Values and Units. They may be re-introduced in CSS4 Values and Units however. There is currently no spec for them, and the calc() spec does not mention that either are valid inside a calc() function. 回答2: A 'pure' css solution actually is possible now using media queries: .yourselector { max-width: calc(100% - 80px); } @media screen and (max

Which is fastest? SELECT SQL_CALC_FOUND_ROWS FROM `table`, or SELECT COUNT(*)

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When you limit the number of rows to be returned by a SQL query, usually used in paging, there are two methods to determine the total number of records: Method 1 Include the SQL_CALC_FOUND_ROWS option in the original SELECT , and then get the total number of rows by running SELECT FOUND_ROWS() : SELECT SQL_CALC_FOUND_ROWS * FROM table WHERE id > 100 LIMIT 10; SELECT FOUND_ROWS(); Method 2 Run the query normally, and then get the total number of rows by running SELECT COUNT(*) SELECT * FROM table WHERE id > 100 LIMIT 10; SELECT COUNT(*) FROM

Is it possible to get a negative value with CSS calc()?

爷,独闯天下 提交于 2019-12-02 23:31:31
Let's say we have a container that is centered in the viewport ... .centered{margin: 0 auto; width:960px;} ... and inside that container I have another that needs to have a width of 100% the viewport width. I could set the margin to ... .widest{margin: 0 -480px} ... for example. The thing is that the value won't be -480px, but actually the viewport width (960px) - the .centered width / 2 ... all good and easy with calc(), only I need a result that is a negative value. .widest{ margin: 0 calc( (100vw - 960px) / 2 ); } I've tried subtracting the lot from 0 to get a negative value, but no go. I

Python函数参数详解

匿名 (未验证) 提交于 2019-12-02 22:11:45
函数的参数除了有必选参数外,还可以使用默认参数,可变参数,关键字参数和命名关键字参数。 位置参数 定义一个计算x^2的函数,以及一个计算x^n的函数 def calc1(x): return x * x def calc2(x, n): s = 1 for i in range(n): s *= x return s 对于这两个函数,其参数都是位置参数,同时也是必选参数,调用函数时实参需和形参一一对应,当参数不对应时会引起错误,例如: >>>calc2(2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: calc2() takes exactly 2 arguments (1 given) >>>calc2(2, 2, 2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: calc2() takes exactly 2 arguments (3 given) 默认参数 对于函数calc2,如若函数调用过程中,计算x^2使用的较多,每次调用都要通过calc2(x, 2)来调用,这样就略显繁琐,此时可以通过默认参数来简化函数的调用,改写函数为: def

linux gcc编译参数顺序问题

匿名 (未验证) 提交于 2019-12-02 21:56:30
初学Linux C编程遇到编译出错 运行下面编译命令,出错 错误信息: /tmp/ccYw8W8E.o: In function `md5test': /home/rivulet/work/Tinyhttpd-master/httpd.c:666: undefined reference to `MD5_Init' /home/rivulet/work/Tinyhttpd-master/httpd.c:667: undefined reference to `MD5_Update' /home/rivulet/work/Tinyhttpd-master/httpd.c:668: undefined reference to `MD5_Final' collect2: error: ld returned 1 exit status make: *** [httpd] Error 1 一开始以为是库没找到,但是在/user/local/lib下面明明存在libcrypto.so库,后来发现下面命令能编译成功 编译时候,-l所知识的库需要跟在.c文件的后面,表明依赖关系,库与库的之间的依赖关系需要通过顺序定义好,写在前面的库依赖于 写在后边的库 具体解释如下: -l $ gcc -Wall calc.c -lm -o calc (correct order) -lm $ cc

calc()在less中编译报错

匿名 (未验证) 提交于 2019-12-02 20:32:16
calc()对大家来说,或许很陌生,不太会相信calc()是css中的部分。因为看其外表像个函数,既然是函数为何又出现在CSS中呢? calc() 函数用于动态计算长度值。 需要注意的是,运算符前后都需要保留一个空格,例如: width: calc(100% - 10px) ; 任何长度值都可以使用calc()函数进行计算; calc()函数支持 "+", "-", "*", "/" 运算; calc()函数使用标准的数学运算优先级规则; 问题 width: calc(100vh - 50px); // 编译后 width: calc(50vh); 注:当时我就郁闷了,怎么会产生这样的现象呢?后来各种查,是由于less的计算方式跟calc方法有重叠,两者在一起有冲突 解决方法 width: calc(~"100vh - 50px"); 文章来源: calc()在less中编译报错

html,css,js实现的一个钟表

懵懂的女人 提交于 2019-12-02 17:00:39
效果如图: 实现代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Clock</title> <style> body { display: flex; flex-direction: column; justify-content: center; align-items: center; width: 100vw; height: 100vh; background: #2e1f27; } p{ color: #854d27; } code{ color: #f4c950; } .clock { --clock-width: 50vmin; width: var(--clock-width); height: var(--clock-width); position: relative; overflow: hidden; border: 6px solid #f4c950; border-radius: 50%; } .clock:after { content: ''; position: absolute; z-index: 10; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 6px;

Subtracting group specific value from rows in pandas

丶灬走出姿态 提交于 2019-12-02 13:10:20
In Pandas I have a data frame consisting of two groups with several samples in each group. Each group has an internal reference value that I want to subtract from all the sample values within that group. s = u"""Group sample value group1 ref1 18.1 group1 smp1 NaN group1 smp2 20.3 group1 smp3 30.0 group2 ref2 16.1 group2 smp4 29.2 group2 smp5 19.9 group2 smp6 28.9 """ df = pd.read_csv(io.StringIO(s), sep='\s+') df = df.set_index(['Group', 'sample']) df Out[82]: value Group sample group1 ref1 18.1 smp1 NaN smp2 20.3 smp3 30.0 group2 ref2 16.1 smp4 29.2 smp5 19.9 smp6 28.9 What I want do do is to

【BZOJ1563】诗人小G(决策单调性DP)

浪尽此生 提交于 2019-12-02 06:05:39
题意:给定N,L,P,求f[N] sum[i]递增,L<=3e6,P<=10 思路:四边形不等式的证明见 https://www.byvoid.com/zhs/blog/noi-2009-poet 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 typedef unsigned int uint; 5 typedef unsigned long long ull; 6 typedef long double ld; 7 typedef pair<int,int> PII; 8 typedef pair<ll,ll> Pll; 9 typedef vector<int> VI; 10 typedef vector<PII> VII; 11 //typedef pair<ll,ll>P; 12 #define N 300010 13 #define M 200010 14 #define INF 1e18 15 #define fi first 16 #define se second 17 #define MP make_pair 18 #define pb push_back 19 #define pi acos(-1) 20 #define mem(a,b) memset(a,b