小编Bar*_*ard的帖子

HTTP 2.0 - 一个TCP/IP连接与6个并行

它表示HTTP 2优于HTTP 1的优势之一是HTTP2具有数据流.在一个TCP/IP连接中最多可以有256个不同的流.但是,在HTTP 1中,最多可以有6个并行连接.HTTP 2允许从256个资源读取数据,这是一个改进,但我认为6个连接(在HTTP 1中)具有比一个TCP/IP连接(在HTTP 2中)更好的吞吐量.尽管如此,HTTP2被认为比HTTP 1更快.所以...我不能正确理解什么?

http http2

5
推荐指数
1
解决办法
1093
查看次数

Apache ExpiresDefault A0 不起作用

我正在设置 apache 标头并且不想缓存 PHP、CGI、Python 或任何动态文件。

我正在使用服务器:Debian 9

我添加了这个配置:

# No caching for dynamic files
<filesMatch "\.(php|cgi|pl|htm)$">
    ExpiresDefault A0
    Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
    Header set Pragma "no-cache"
</filesMatch>
Run Code Online (Sandbox Code Playgroud)

但显示以下错误:

AH00526: Syntax error on line 86 of /etc/apache2/conf-enabled/headers.conf: Invalid command 'ExpiresDefault', perhaps misspelled or defined by a module not included in the server configuration Action '-t' failed.
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个错误?

apache2.4

3
推荐指数
1
解决办法
2312
查看次数

Perl printf/sprintf 的舍入错误

谁能解释一下这是怎么回事:

#!/usr/bin/perl -w
my $amount = 74.32 * 100.00;

printf "Unformatted Amount:${amount}:\n";
printf " Formatted Amount:%.11d:\n", $amount;
Run Code Online (Sandbox Code Playgroud)

输出这个:

$ ./test.pl
Unformatted Amount:7432:
  Formatted Amount:00000007431:
Run Code Online (Sandbox Code Playgroud)

目前我已经停止使用 printf 和 sprintf 因为我不信任它们。所以我正在这样做:

#!/usr/bin/perl -w
my $amount = 74.32 * 100.00;

$formatted_amount = "00000000000" . $amount;
$formatted_amount = substr($formated_amount,length($formatted_amount)-11,11);

printf "Unformatted Amount:${amount}:\n";
printf "  Formatted Amount:${formatted_amount}:\n";
Run Code Online (Sandbox Code Playgroud)

这有效,但很好奇为什么我需要这样做。

我了解二进制数字如何无法准确表示所有以 10 为基数的数字,并且已阅读此 Stack Overflow 条目:如何消除 Perl 舍入错误,但老实说,我没想到会在如此看似简单的示例中看到问题。

$amount 的值也是的。只是 printf 没有正确打印它!

有任何想法吗?

perl printf rounding-error

1
推荐指数
1
解决办法
853
查看次数

标签 统计

apache2.4 ×1

http ×1

http2 ×1

perl ×1

printf ×1

rounding-error ×1