mysql -u root CREATE DATABASE wordpressdb; CREATE USER wordpressuser@localhost IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpressdb.* TO wordpressuser@localhost;
安装配置nginx php
安装nginx和php-7.4,还有php一些组件 nginx 配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
server { listen 80 default_server; listen [::]:80 default_server; server_name your_domain.com;
root /var/www/html; index index.php index.html index.htm;
开始使用http访问,后面切换到https后一直提示错误说跳转太多次。后来发现原因是套了cloudflare,cloudflare设置的是前端https后端http, 后端以http访问真实服务器后又跳转到https。所以请求一直在cf<->wordpress之间无限跳转。所以首先要设置cloudflare的代理模式为严格安全,strict full safe,也就是前端和后端都用证书。然后修改wordpress的url方法有很多,之前通过直接修改数据库,这次发现wordpress有个wp的命令行工具,一键修改。
[root@netpanc ~]# resolvectl status Global LLMNR setting: yes MulticastDNS setting: yes DNSOverTLS setting: no DNSSEC setting: allow-downgrade DNSSEC supported: yes DNSSEC NTA: 10.in-addr.arpa 16.172.in-addr.arpa 168.192.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.arpa 24.172.in-addr.arpa 25.172.in-addr.arpa 26.172.in-addr.arpa 27.172.in-addr.arpa 28.172.in-addr.arpa 29.172.in-addr.arpa 30.172.in-addr.arpa 31.172.in-addr.arpa corp d.f.ip6.arpa home internal intranet lan local private test
Link 2 (eth0) Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 mDNS/IPv4 mDNS/IPv6 LLMNR setting: yes MulticastDNS setting: yes DNSOverTLS setting: no DNSSEC setting: allow-downgrade DNSSEC supported: yes Current DNS Server: 114.114.114.114 DNS Servers: 114.114.114.114
在其他设备上ping可以成功
1 2 3 4
PING netpanc.local (192.168.4.43) 56(84) bytes of data. 64 bytes from netpanc.local (192.168.4.43): icmp_seq=1 ttl=64 time=0.350 ms 64 bytes from netpanc.local (192.168.4.43): icmp_seq=2 ttl=64 time=0.799 ms 64 bytes from netpanc.local (192.168.4.43): icmp_seq=3 ttl=64 time=0.733 ms
optimize_for (file option): Can be set to SPEED, CODE_SIZE, or LITE_RUNTIME. This affects the C++ and Java code generators (and possibly third-party generators) in the following ways:
SPEED (default): The protocol buffer compiler will generate code for serializing, parsing, and performing other common operations on your message types. This code is highly optimized.
CODE_SIZE: The protocol buffer compiler will generate minimal classes and will rely on shared, reflection-based code to implement serialialization, parsing, and various other operations. The generated code will thus be much smaller than with SPEED, but operations will be slower. Classes will still implement exactly the same public API as they do in SPEED mode. This mode is most useful in apps that contain a very large number of .proto files and do not need all of them to be blindingly fast.
LITE_RUNTIME: The protocol buffer compiler will generate classes that depend only on the “lite” runtime library (libprotobuf-lite instead of libprotobuf). The lite runtime is much smaller than the full library (around an order of magnitude smaller) but omits certain features like descriptors and reflection. This is particularly useful for apps running on constrained platforms like mobile phones. The compiler will still generate fast implementations of all methods as it does in SPEED mode. Generated classes will only implement the MessageLite interface in each language, which provides only a subset of the methods of the full Message interface.
// 先遍历物品,后遍历重量 for (int i = 1; i < N; i++) { for (int v = 0; v <= V; v++) { // F [i, v] ← max{F [i − 1, v], F [i − 1, v − Ci] + Wi} // F[i][v] = MAX(F[i - 1][v], F[i - 1][v - cost[i]] + value[i]); int bufang = dp[i - 1][v]; dp[i][v] = bufang; if (v >= cost[i]) { int fang = dp[i - 1][v - cost[i]] + value[i]; dp[i][v] = MAX(bufang, fang); } } }
for (int i = 0; i < N; i++) { for (int j = 0; j <= V; j++) { printf("%d\t", dp[i][j]); } printf("\n"); } printf("%d\n", dp[N - 1][V]); }
voidO1Package_N_plus_1(){
int dp[N + 1][V + 1];
// 使用0个物品的价值为0 for (int i = 0; i <= V; i++) { dp[0][i] = 0; }
// 先遍历物品,后遍历重量 for (int i = 1; i <= N; i++) { for (int v = 0; v <= V; v++) { dp[i][v] = dp[i - 1][v]; //当重量不够装i时,价值为装i-1的价值, //此步骤以备i+1时使用(下一个i循环) if (v >= cost[i - 1]) { dp[i][v] = MAX(dp[i - 1][v], dp[i - 1][v - cost[i - 1]] + value[i - 1]); } } }
for (int i = 0; i <= N; i++) { for (int j = 0; j <= V; j++) { printf("%d\t", dp[i][j]); } printf("\n"); } printf("%d\n", dp[N][V]); }
voidO1Package_N_plus_1_origin(){
int dp[N + 1][V + 1];
// 使用0个物品的价值为0 for (int i = 0; i <= V; i++) { dp[0][i] = 0; }
// 先遍历物品,后遍历重量 for (int i = 0; i < N; i++) { for (int v = 0; v <= V; v++) { // 1. 当物品大于承重,物品不会放到背包,价值等于不放此物品时的情况 // 即使物品小于承重,说明物品会放到背包。提前多赋值一次也是允许的 dp[i + 1][v] = dp[i][v]; if (v >= cost[i]) { dp[i + 1][v] = MAX(dp[i][v], dp[i][v - cost[i]] + value[i]); } } }
for (int i = 0; i <= N; i++) { for (int j = 0; j <= V; j++) { printf("%d\t", dp[i][j]); } printf("\n"); } printf("%d\n", dp[N][V]); }
voidO1Package_one_array_n(){
int dp[V + 1];
// 使用0个物品的价值为0 for (int i = 0; i <= V; i++) { dp[i] = 0; }
// 先遍历物品,后遍历重量 for (int i = N - 1; i >= 0; i--) { for (int v = V; v >= cost[i]; v--) { int bufang = dp[v]; int fang = dp[v - cost[i]] + value[i]; dp[v] = MAX(bufang, fang); } }
// 0容量的价值为0, 合法 for (int i = 0; i < cost[0]; i++) { dp[0][i] = 0; }
// 初始化当包承重大于物品0重量的情况 for (int i = cost[0]; i <= V; i++) { // 当只装物品0时,包的价值就是物品0的价值 dp[0][i] = i / cost[0] * value[0]; }
// 先遍历物品,后遍历重量 for (int i = 1; i < N; i++) { for (int v = 0; v <= V; v++) { dp[i][v] = dp[i - 1][v]; //当重量不够装i时,价值为装i-1的价值, //此步骤以备i+1时使用(下一个i循环) for (int k = 1; k <= v / cost[i]; k++) { dp[i][v] = MAX(dp[i - 1][v], dp[i - 1][v - k * cost[i]] + k * value[i]); } } }
for (int i = 0; i < N; i++) { for (int j = 0; j <= V; j++) { printf("%d\t", dp[i][j]); } printf("\n"); } printf("%d\n", dp[N - 1][V]); }
voidCompletePackage_use_n_plus_1(){
int dp[N + 1][V + 1];
// 0容量的价值为0, 合法 for (int i = 0; i <= V; i++) { dp[0][i] = 0; }
// 先遍历物品,后遍历重量 for (int i = 1; i <= N; i++) { for (int v = 0; v <= V; v++) { dp[i][v] = dp[i - 1][v]; //当重量不够装i时,价值为装i-1的价值, //此步骤以备i+1时使用(下一个i循环) for (int k = 1; k <= v / cost[i-1]; k++) { dp[i][v] = MAX(dp[i - 1][v], dp[i - 1][v - k * cost[i-1]] + k * value[i-1]); } } }
for (int i = 0; i <= N; i++) { for (int j = 0; j <= V; j++) { printf("%d\t", dp[i][j]); } printf("\n"); } printf("%d\n", dp[N][V]); }
voidCompletePackage_use_one_array_no_reverse_V(){
int dp[V + 1];
// 0容量的价值为0, 合法 for (int i = 0; i <= V; i++) { dp[i] = 0; }
// 先遍历物品,后遍历重量 for (int i = 1; i <= N; i++) { for (int v = 0; v <= V; v++) { for (int k = 1; k <= v / cost[i-1]; k++) { dp[v] = MAX(dp[v], dp[v - k * cost[i-1]] + k * value[i-1]); } } }
// 0容量的价值为0, 合法 for (int i = 0; i <= V; i++) { dp[i] = 0; }
// 先遍历物品,后遍历重量 for (int i = 1; i <= N; i++) { for (int v = V; v <= cost[i-1]; v--) { for (int k = 1; k <= v / cost[i-1]; k++) { dp[v] = MAX(dp[v], dp[v - k * cost[i-1]] + k * value[i-1]); } } }
Expected pattern: appmanager_mock.notify_add_event( Any arguments ) Expected matches: exactly 2 Actual matches : 3 Actual sequence : total of 3 actual invocations: appmanager_mock.notify_add_event(?, asd) appmanager_mock.notify_add_event(?, asd) appmanager_mock.notify_add_event(?, asd)