迁移tomcat10 XXX cannot be cast to jakarta.servlet.Filter 解决方案

之前公司有个老项目(struts2+ibatis)的要升级到迁移tomcat10,结果死活无法起来。

看来下日志 报错都是 XXX cannot be cast to jakarta.servlet.Filter,搜了半天终于整出了解决方案。

报错原因是坑爹的tomcat10把javax.servlet-api名叫jaraka.servlet了(这不是蛋疼吗!!!)

解决方案有俩

1.修改代码,手动把包引用从 Javax.XXX改成 Jaraka.XXX 然后编译

2.使用apache官网提供的迁移工具 tomcat-jakartaee-migration 对编译后的项目处理一下,具体使用可以去看下项目的描述,一行命令就可以执行了。

这里提供一个现成的下载

具体使用方法:

如果是linux系统,进入bin目录,bash migrate.sh 旧项目(支持文件夹和war包) 生成的新项目(支持文件夹和war包),例如 bash migrate.sh old.war new.war。

如果是window系统,进入lib目录, java -jar jakartaee-migration-1.0.0.jar old new,跟上面差不多,脚本里就是执行的jakartaee-migration-1.0.0.jar。

ps:如果还不能启动,看看原本项目中pom.xml的javax.servlet-api依赖范围scope是否改成了provided,如果没有还是会有那个报错哦。

HostHatch 独立日优惠

因为Chia币的影响,储存机型都普遍涨价了,但这次普遍流量都给的很多,特别是nvme机。

两年付的性价比依旧可以的,购买方法:

1.注册账号存入资金 https://hosthatch.com/a?id=1837

2.点击下列的购买链接下单(要先预存余额才能购买),如果是两年付,需要额外发送工单获取两年付的特惠.

Storage (only available in Chicago – and very limited quantity):

1x 2.4+ GHz
512 MB RAM
250 GB disk
1 TB bandwidth
$15 per year
Pay for two years (+$7) – get doubled RAM and +9 TB free bandwidth
https://manage.hosthatch.com/billing/order/chi-250g-storage
1x 2.4+ GHz
1 GB RAM
1 TB usable storage
3 TB bandwidth
$40 per year
Chicago
Pay for two years – get doubled RAM and +20 TB free bandwidth
https://manage.hosthatch.com/billing/order/chi-1tb-storage/


NVMe plans (Europe – Amsterdam, Stockholm, Zurich, Oslo, Vienna, Warsaw, London, Madrid and Milan)

1 CPU core (12.5% dedicated, burstable up to 100%)
1 GB RAM
10 GB RAID-10 NVMe
1 TB bandwidth
$15 per year
Pay for two years – get doubled RAM, storage, and +5 TB free bandwidth
https://manage.hosthatch.com/billing/order/nvme1-ams
https://manage.hosthatch.com/billing/order/nvme1-sto
https://manage.hosthatch.com/billing/order/nvme1-zrh
https://manage.hosthatch.com/billing/order/nvme1-osl
https://manage.hosthatch.com/billing/order/nvme1-vie
https://manage.hosthatch.com/billing/order/nvme1-waw
https://manage.hosthatch.com/billing/order/nvme1-lon
https://manage.hosthatch.com/billing/order/nvme1-mad
https://manage.hosthatch.com/billing/order/nvme1-mil
2 CPU cores (50% dedicated, burstable up to 200%)
4 GB RAM
20 GB NVMe SSD
5 TB bandwidth
$30 per year
Pay for two years – get doubled RAM, storage, and +15 TB free bandwidth
https://manage.hosthatch.com/billing/order/nvme4-ams
https://manage.hosthatch.com/billing/order/nvme4-sto
https://manage.hosthatch.com/billing/order/nvme4-zrh
https://manage.hosthatch.com/billing/order/nvme4-osl
https://manage.hosthatch.com/billing/order/nvme4-vie
https://manage.hosthatch.com/billing/order/nvme4-waw
https://manage.hosthatch.com/billing/order/nvme4-lon
https://manage.hosthatch.com/billing/order/nvme4-mad
https://manage.hosthatch.com/billing/order/nvme4-mil
3 CPU cores (100% dedicated, burstable up to 300%)
8 GB RAM
40 GB NVMe SSD
10 TB bandwidth
$60 per year
Pay for two years – get doubled RAM, storage, and +20 TB free bandwidth
https://manage.hosthatch.com/billing/order/nvme8-ams
https://manage.hosthatch.com/billing/order/nvme8-sto
https://manage.hosthatch.com/billing/order/nvme8-zrh
https://manage.hosthatch.com/billing/order/nvme8-osl
https://manage.hosthatch.com/billing/order/nvme8-vie
https://manage.hosthatch.com/billing/order/nvme8-waw
https://manage.hosthatch.com/billing/order/nvme8-lon
https://manage.hosthatch.com/billing/order/nvme8-mad
https://manage.hosthatch.com/billing/order/nvme8-mil


NVMe plans (North America – Los Angeles, Chicago and New York):

1 CPU core (12.5% dedicated, burstable up to 100%)
1 GB RAM
10 GB RAID-10 NVMe
1 TB bandwidth
$15 per year
Pay for two years – get doubled RAM, storage, and +5 TB free bandwidth
https://manage.hosthatch.com/billing/order/nvme1-lax
https://manage.hosthatch.com/billing/order/nvme1-ny
https://manage.hosthatch.com/billing/order/nvme1-chi
2 CPU cores (50% dedicated, burstable up to 200%)
4 GB RAM
20 GB NVMe SSD
5 TB bandwidth
$30 per year
Pay for two years – get doubled RAM, storage, and +15 TB free bandwidth
https://manage.hosthatch.com/billing/order/nvme4-lax
https://manage.hosthatch.com/billing/order/nvme4-ny
https://manage.hosthatch.com/billing/order/nvme4-chi
3 CPU cores (100% dedicated, burstable up to 300%)
8 GB RAM
40 GB NVMe SSD
10 TB bandwidth
$60 per year
https://manage.hosthatch.com/billing/order/ams-16g-nvme
Pay for two years – get doubled RAM, storage, and +20 TB free bandwidth
https://manage.hosthatch.com/billing/order/nvme8-lax
https://manage.hosthatch.com/billing/order/nvme8-ny
https://manage.hosthatch.com/billing/order/nvme8-chi


NVMe plans (APAC – Hong Kong and Sydney):

1 CPU core (12.5% dedicated, burstable up to 100%)
1 GB RAM
10 GB RAID-10 NVMe
500 GB bandwidth
$15 per year
Pay for two years – get doubled RAM, storage, and bandwidth
https://manage.hosthatch.com/billing/order/nvme1-hkg
https://manage.hosthatch.com/billing/order/nvme1-syd
2 CPU cores (50% dedicated, burstable up to 200%)
4 GB RAM
20 GB NVMe SSD
1 TB bandwidth
$35 per year
Pay for two years – get doubled RAM, storage, and bandwidth
https://manage.hosthatch.com/billing/order/nvme4-hkg
https://manage.hosthatch.com/billing/order/nvme4-syd
3 CPU cores (100% dedicated, burstable up to 300%)
8 GB RAM
40 GB NVMe SSD
2 TB bandwidth
$65 per year
Pay for two years – get doubled RAM, storage, and bandwidth
https://manage.hosthatch.com/billing/order/nvme8-hkg
https://manage.hosthatch.com/billing/order/nvme8-syd


Bundles:

Choose any 7 locations, 1 VM per location:

1 CPU core (12.5% dedicated, burstable up to 100%)
1 GB RAM
10 GB RAID-10 NVMe
1 TB bandwidth
$65 per year

To order, login to your account with us, top up the credit, and open a sales ticket with the 7 locations of your choosing.
All locations bundle, 1 VM per location:

1 CPU core (12.5% dedicated, burstable up to 100%)
1 GB RAM
10 GB RAID-10 NVMe
1 TB bandwidth
$110 per year

To order, login to your account with us, top up the credit, and open a sales ticket.

[Buyvm]拉斯维加斯VPS测试

buyvm是老商家了,性价比可以,特色就是无限流量+可以加储存块 每256G 1.25美元,用支付宝支付是加元结算的,性价比不错。

博主有一款他家最便宜的月付2刀的VPS(支付宝支付是2加元,大概每月10块左右)

以下是GeekBench5.sh、bench.sh测评,io性能还可以。国内速度看着还不错的,不知道脚本测试的准不准。

root@localhost:~# curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/yabs.sh | bash

# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2020-12-29                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Fri 09 Apr 2021 08:32:16 PM CST

Basic System Information:
---------------------------------
Processor  : AMD Ryzen 9 3900X 12-Core Processor
CPU cores  : 1 @ 3792.870 MHz
AES-NI     : ✔ Enabled
VM-x/AMD-V : ✔ Enabled
RAM        : 483.2 MiB
Swap       : 512.0 MiB
Disk       : 9.3 GiB

Generating fio test file...
fio Disk Speed Tests (Mixed R/W 50/50):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ---- 
Read       | 192.12 MB/s  (48.0k) | 1.92 GB/s    (30.0k)
Write      | 192.63 MB/s  (48.1k) | 1.93 GB/s    (30.2k)
Total      | 384.76 MB/s  (96.1k) | 3.86 GB/s    (60.3k)
           |                      |                     
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ---- 
Read       | 2.00 GB/s     (3.9k) | 2.39 GB/s     (2.3k)
Write      | 2.11 GB/s     (4.1k) | 2.55 GB/s     (2.4k)
Total      | 4.12 GB/s     (8.0k) | 4.95 GB/s     (4.8k)

iperf3 Network Speed Tests (IPv4):
---------------------------------
Provider        | Location (Link)           | Send Speed      | Recv Speed     
                |                           |                 |                
Clouvider       | London, UK (10G)          | 1.01 Gbits/sec  | 237 Mbits/sec  
Online.net      | Paris, FR (10G)           | 876 Mbits/sec   | 202 Mbits/sec  
WorldStream     | The Netherlands (10G)     | busy            | busy           
Biznet          | Jakarta, Indonesia (1G)   | 544 Mbits/sec   | 90.7 Mbits/sec 
Clouvider       | NYC, NY, US (10G)         | 1.08 Gbits/sec  | 205 Mbits/sec  
Velocity Online | Tallahassee, FL, US (10G) | 1.06 Gbits/sec  | 307 Mbits/sec  
Clouvider       | Los Angeles, CA, US (10G) | 1.10 Gbits/sec  | 459 Mbits/sec  
Iveloz Telecom  | Sao Paulo, BR (2G)        | 484 Mbits/sec   | 91.9 Mbits/sec 

Geekbench 5 Benchmark Test:
---------------------------------
Test            | Value                         
                |                               
Single Core     | 688                           
Multi Core      | 690                           
Full Test       | https://browser.geekbench.com/v5/cpu/7342246
----------------------------------------------------------------------
 CPU Model             : AMD Ryzen 9 3900X 12-Core Processor
 CPU Cores             : 1
 CPU Frequency         : 3792.870 MHz
 CPU Cache             : 512 KB
 Total Disk            : 9.3 GB (3.7 GB Used)
 Total Mem             : 483 MB (67 MB Used)
 Total Swap            : 511 MB (44 MB Used)
 System uptime         : 1 days, 20 hour 27 min
 Load average          : 0.00, 0.11, 0.12
 OS                    : Debian GNU/Linux 10
 Arch                  : x86_64 (64 Bit)
 Kernel                : 4.19.0-16-amd64
 TCP CC                : bbr
 Virtualization        : KVM
 Organization          : AS53667 FranTech Solutions
 Location              : Las Vegas / US
 Region                : Nevada
----------------------------------------------------------------------
 I/O Speed(1st run)    : 1.1 GB/s
 I/O Speed(2nd run)    : 1.1 GB/s
 I/O Speed(3rd run)    : 1.0 GB/s
 Average I/O speed     : 1092.3 MB/s
----------------------------------------------------------------------
 Node Name        Upload Speed      Download Speed      Latency     
 Speedtest.net    1090.06 Mbps      256.32 Mbps         56.99 ms    
 Shanghai   CT    144.78 Mbps       485.96 Mbps         149.07 ms   
 Shanghai   CU    325.92 Mbps       425.92 Mbps         210.93 ms   
 Guangzhou  CT    2.71 Mbps         205.45 Mbps         166.96 ms   
 Shenzhen   CU    403.94 Mbps       371.04 Mbps         182.94 ms   
 Hongkong   CN    377.38 Mbps       551.20 Mbps         190.44 ms   
 Singapore  SG    392.22 Mbps       502.75 Mbps         192.75 ms   
 Tokyo      JP    199.29 Mbps       7.16 Mbps           115.58 ms   
----------------------------------------------------------------------

[Pulsed Media]SeedBox评测

前几天在let看见一款seedboox促销。

这是促销地址:https://www.lowendtalk.com/discussion/170669/pulsed-media-value1000-seedboxes-lets-try-this-again-6tb-for-just-6-99-mo-4tb-4-99-month/p1

什么是SeedBox呢?

SeedBox其实就是一台共享的独立服务器(而且只有一个共享的IP),大家都用同一个系统,用不同的用户登录(没有root权限)。SeedBox商家会预装各种下载软件(例如deluge、utorrent)给用户下载种子,而且也会提供从seedbox上下载资源回本地的功能。

Seedbox有啥好处呢?

1、抗投诉,可以随意的玩BT下载,不会因为蜜罐版权投诉而停机。

2、网络连通性好,到各大数据中心的延迟和速度都不错,下载东西很舒服。

SeedBox的缺点

1、IP一般是共享的,国内的PT站不允许使用共享IP盒子(外站报备下IP就行)。

2、资源争夺严重,邻居都是各种下载折腾的猛男,iowait有时候会很高,还有直接用Seedbox进行视频转码的邻居。

3、硬盘基本都是RAID0的,虽然每TB硬盘的价格的价格很香,但容易随时数据火葬场,不能用作网盘。

趁机上车试试水,买了一款最便宜的,看着还挺不错的>.<。

V1000 M: 6TB Storage, 6GB rTorrent Ram, 1Gbps, Unlimited* External Traffic, Unlimited Internal Traffic: 13.99€ 6.99€ Per Month

试了好几个国内测速的脚本都跑不全=.=机房应该在华沙那边,线路应该都不咋地的,带宽还挺足的。

以下是 bench.sh、nench.sh和geekbench.sh跑分的情况

 国内测速wget -qO- bench.sh | bash
----------------------------------------------------------------------
 CPU Model             : Six-Core AMD Opteron(tm) Processor 2419 EE
 CPU Cores             : 6
 CPU Frequency         : 1000.000 MHz
 CPU Cache             : 512 KB
 Total Disk            : 29724.0 GB (13316.6 GB Used)
 Total Mem             : 48295 MB (20218 MB Used)
 Total Swap            : 5723 MB (842 MB Used)
 System uptime         : 12 days, 20 hour 16 min
 Load average          : 1.92, 2.37, 2.80
 OS                    : Debian GNU/Linux 10
 Arch                  : x86_64 (64 Bit)
 Kernel                : 4.19.0-14-amd64
 TCP CC                : 
 Virtualization        : Dedicated
 Organization          : AS203003 Magna Capax Finland Oy
 Location              : Helsinki / FI
 Region                : Uusimaa
----------------------------------------------------------------------
 I/O Speed(1st run)    : 292 MB/s
 I/O Speed(2nd run)    : 250 MB/s
 I/O Speed(3rd run)    : 233 MB/s
----------------------------------------------------------------------
 CPU Model             : Six-Core AMD Opteron(tm) Processor 2419 EE
 CPU Cores             : 6
 CPU Frequency         : 1800.000 MHz
 CPU Cache             : 512 KB
 Total Disk            : 29724.0 GB (13316.6 GB Used)
 Total Mem             : 48295 MB (20289 MB Used)
 Total Swap            : 5723 MB (848 MB Used)
 System uptime         : 12 days, 20 hour 22 min
 Load average          : 2.12, 2.44, 2.70
 OS                    : Debian GNU/Linux 10
 Arch                  : x86_64 (64 Bit)
 Kernel                : 4.19.0-14-amd64
 TCP CC                : 
 Virtualization        : Dedicated
 Organization          : AS203003 Magna Capax Finland Oy
 Location              : Helsinki / FI
 Region                : Uusimaa
----------------------------------------------------------------------
 I/O Speed(1st run)    : 286 MB/s
 I/O Speed(2nd run)    : 220 MB/s
 I/O Speed(3rd run)    : 194 MB/s
 Average I/O speed     : 233.3 MB/s
----------------------------------------------------------------------
 Node Name        Upload Speed      Download Speed      Latency     
 Speedtest.net    862.60 Mbps       930.97 Mbps         0.77 ms     
 Shanghai   CT    101.81 Mbps       942.38 Mbps         245.69 ms   
 Guangzhou  CT    8.67 Mbps         475.79 Mbps         225.75 ms   
 Hongkong   CN    446.98 Mbps       957.71 Mbps         212.69 ms   
 Tokyo      JP    260.18 Mbps       5.89 Mbps           162.12 ms   
----------------------------------------------------------------------
国际测速+全面跑分(curl -s wget.racing/nench.sh | bash; curl -s wget.racing/nench.sh | bash) 2>&1 | tee nench.log

-------------------------------------------------
 nench.sh v2019.07.20 -- https://git.io/nench.sh
 benchmark timestamp:    2021-04-09 12:25:53 UTC
-------------------------------------------------

Processor:    Six-Core AMD Opteron(tm) Processor 2419 EE
CPU cores:    6
Frequency:    1000.000 MHz
RAM:          47Gi
bash: line 156: swapon: command not found
Swap:         -
Kernel:       Linux 4.19.0-14-amd64 x86_64

Disks:
sda    7.3T  HDD
sdb    7.3T  HDD
sdc    7.3T  HDD
sdd    7.3T  HDD

CPU: SHA256-hashing 500 MB
    6.098 seconds
CPU: bzip2-compressing 500 MB
    11.628 seconds
CPU: AES-encrypting 500 MB
    8.596 seconds

ioping: seek rate
    min/avg/max/mdev = 80.2 us / 447.1 us / 102.4 ms / 2.64 ms
ioping: sequential read speed
    generated 1.90 k requests in 5.03 s, 474 MiB, 376 iops, 94.2 MiB/s

dd: sequential write speed
    1st run:    267.98 MiB/s
    2nd run:    227.93 MiB/s
    3rd run:    247.96 MiB/s
    average:    247.96 MiB/s

IPv4 speedtests
    your IPv4:    185.148.3.xxxx

    Cachefly CDN:         56.27 MiB/s
    Leaseweb (NL):        86.31 MiB/s
    Softlayer DAL (US):   7.88 MiB/s
    Online.net (FR):      77.47 MiB/s
    OVH BHS (CA):         19.60 MiB/s

No IPv6 connectivity detected
-------------------------------------------------

-------------------------------------------------
 nench.sh v2019.07.20 -- https://git.io/nench.sh
 benchmark timestamp:    2021-04-09 12:27:06 UTC
-------------------------------------------------

Processor:    Six-Core AMD Opteron(tm) Processor 2419 EE
CPU cores:    6
Frequency:    1000.000 MHz
RAM:          47Gi
bash: line 156: swapon: command not found
Swap:         -
Kernel:       Linux 4.19.0-14-amd64 x86_64

Disks:
sda    7.3T  HDD
sdb    7.3T  HDD
sdc    7.3T  HDD
sdd    7.3T  HDD

CPU: SHA256-hashing 500 MB
    6.138 seconds
CPU: bzip2-compressing 500 MB
    11.531 seconds
CPU: AES-encrypting 500 MB
    8.685 seconds

ioping: seek rate
    min/avg/max/mdev = 78.6 us / 321.0 us / 56.3 ms / 1.55 ms
ioping: sequential read speed
    generated 1.39 k requests in 5.00 s, 347 MiB, 277 iops, 69.4 MiB/s

dd: sequential write speed
    1st run:    281.33 MiB/s
    2nd run:    212.67 MiB/s
    3rd run:    205.04 MiB/s
    average:    233.01 MiB/s

IPv4 speedtests
    your IPv4:    185.148.3.xxxx

    Cachefly CDN:         93.63 MiB/s
    Leaseweb (NL):        86.15 MiB/s
    Softlayer DAL (US):   8.68 MiB/s
    Online.net (FR):      77.53 MiB/s
    OVH BHS (CA):         19.39 MiB/s

No IPv6 connectivity detected
-------------------------------------------------
dragonfs@3-178solange:~/git/AutoRclone/accounts/fclone-v0.4.1-linux-amd64$ curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/yabs.sh | bash
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2020-12-29                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Fri 09 Apr 2021 03:34:43 PM EEST

Basic System Information:
---------------------------------
Processor  : Six-Core AMD Opteron(tm) Processor 2419 EE
CPU cores  : 6 @ 1000.000 MHz
AES-NI     : � Disabled
VM-x/AMD-V : � Enabled
RAM        : 47.2 GiB
Swap       : 5.6 GiB
Disk       : 28.9 TiB

fio Disk Speed Tests (Mixed R/W 50/50):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ---- 
Read       | 1.77 MB/s      (442) | 25.31 MB/s     (395)
Write      | 1.79 MB/s      (448) | 25.83 MB/s     (403)
Total      | 3.56 MB/s      (890) | 51.14 MB/s     (798)
           |                      |                     
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ---- 
Read       | 120.60 MB/s    (235) | 142.13 MB/s    (138)
Write      | 127.01 MB/s    (248) | 151.60 MB/s    (148)
Total      | 247.61 MB/s    (483) | 293.73 MB/s    (286)

iperf3 Network Speed Tests (IPv4):
---------------------------------
Provider        | Location (Link)           | Send Speed      | Recv Speed     
                |                           |                 |                
Clouvider       | London, UK (10G)          | 845 Mbits/sec   | 926 Mbits/sec  
Online.net      | Paris, FR (10G)           | 854 Mbits/sec   | 925 Mbits/sec  
WorldStream     | The Netherlands (10G)     | busy            | busy           
Biznet          | Jakarta, Indonesia (1G)   | 625 Mbits/sec   | 271 Mbits/sec
Clouvider       | NYC, NY, US (10G)         | 565 Mbits/sec   | 890 Mbits/sec
Velocity Online | Tallahassee, FL, US (10G) | 782 Mbits/sec   | 870 Mbits/sec
Clouvider       | Los Angeles, CA, US (10G) | 328 Mbits/sec   | 850 Mbits/sec
Iveloz Telecom  | Sao Paulo, BR (2G)        | 728 Mbits/sec   | 17.2 Mbits/sec

Geekbench 5 Benchmark Test:
---------------------------------
Test            | Value
                |
Single Core     | 271
Multi Core      | 1256
Full Test       | https://browser.geekbench.com/v5/cpu/7342323

qexw美国三期9929线路评测分享

没啥技术分享,只能用VPS评测凑凑数了。

前几天上车了企鹅小屋家的9929预售机,虽然之前一直有听说这家风评很差(主要是在随意封禁用户、退款周期长、工单支持垃圾这些),不过还是架不住有便宜的9929路线,所以上车一台99年付的。

首先就是大家都关心的线路测试了,竟然还真是从cera拿的母鸡,不知道带不带防御,如果带防御的话甚至还能反代网站玩。看样子是三网联通9929回程,有个别测速节点拉跨,不知道是不是触发了流控机制。性能测试就懒得做了,反正这玩意也干不了啥大事,就是图个线路好。

wget -qO- --no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash
--------------------------------------------------------------------------------------------------------------------------------------------
 Superbench.sh -- https://www.oldking.net/350.html
 Mode  : Standard    Version : 1.1.7
 Usage : wget -qO- sb.oldking.net | bash
----------------------------------------------------------------------
 CPU Model            : Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz
 CPU Cores            : 1 Cores 2499.998 MHz x86_64
 CPU Cache            : 30720 KB
 OS                   : Debian GNU/Linux 10 (64 Bit) KVM
 Kernel               : 4.19.0-5-amd64
 Total Space          : 1.3 GB / 9.6 GB
 Total RAM            : 69 MB / 483 MB (381 MB Buff)
 Total SWAP           : 1 MB / 255 MB
 Uptime               : 1 days 3 hour 43 min
 Load Average         : 0.00, 0.00, 0.00
 TCP CC               : bbr
 ASN & ISP            : AS40065, Cnservers LLC
 Organization         : CloudRadium L.L.C
 Location             : Los Angeles, United States / US
 Region               : California
----------------------------------------------------------------------
 I/O Speed( 1.0GB )   : 271 MB/s
 I/O Speed( 1.0GB )   : 336 MB/s
 I/O Speed( 1.0GB )   : 378 MB/s
 Average I/O Speed    : 328.3 MB/s
----------------------------------------------------------------------
 Node Name        Upload Speed      Download Speed      Latency
 Speedtest.net    148.41 Mbit/s     377.97 Mbit/s       (*)64.42 ms
 Fast.com         0.00 Mbit/s       135.6 Mbit/s        -
 Nanjing 5G   CT  149.52 Mbit/s     285.06 Mbit/s       155.85 ms
 Hefei 5G     CT  146.13 Mbit/s     235.75 Mbit/s       159.14 ms
 Guangzhou 5G CT  27.81 Mbit/s      155.56 Mbit/s       154.62 ms
 TianJin 5G   CU  149.49 Mbit/s     231.72 Mbit/s       151.24 ms
 Shanghai 5G  CU  150.11 Mbit/s     359.05 Mbit/s       150.43 ms
 Guangzhou 5G CU  149.45 Mbit/s     264.86 Mbit/s       166.61 ms
 Tianjin 5G   CM  18.84 Mbit/s      199.74 Mbit/s       178.93 ms
 Wuxi 5G      CM  142.46 Mbit/s     202.02 Mbit/s       160.32 ms
 Nanjing 5G   CM  28.70 Mbit/s      42.12 Mbit/s        166.80 ms
 Hefei 5G     CM  139.31 Mbit/s     226.26 Mbit/s       163.31 ms
 Changsha 5G  CM  146.99 Mbit/s     324.79 Mbit/s       164.26 ms
----------------------------------------------------------------------
 Finished in  : 6 min 36 sec
 Timestamp    : 2021-03-26 23:05:22 GMT+8
 Results      : ./superbench.log
----------------------------------------------------------------------
 Share result:
 · https://www.speedtest.net/result/c/152cc59c-7b47-4298-9b95-c7e1df63a397
 · https://paste.ubuntu.com/p/qxTVwNbtqQ/
----------------------------------------------------------------------

ikoula 耍猴记录

本来说的优惠码是 NNKL,结果中午就被人发现 NNK 优惠码实际可用并且可以下单,结果到促销时间NNKL代码压根没法使用。这样也就算了,而后嫌弃卖的太便宜以库存不足为理由退款了大部分的订单,而且退款的顺序竟然是先下单的先退款。最后搞半天到晚上11点拖着一直没付款的用户付款了,结果反而是秒开通。这商家管理的混乱程度和随意程度也是我前所未见的,难怪明明是98年的老厂经营了20多年还是个默默无闻的商家。

最大子序和 最大连续子数组和

给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。

初看有点懵逼,一直想有啥简单的解法,想半天只想到用暴力做orz

时间复杂度 O(n^3) 时间爆炸

class Solution {
    public int maxSubArray(int[] nums) {
        int max = -100;
        int sum = 0;
        if(nums.length == 1){
            return nums[0];
        }
        for(int i = 0;i < nums.length; i++){
            for(int j = i ; j < nums.length; j++){
                sum = 0;
                for(int k = i ; k <= j ; k++ ){
                    sum += nums[k];
                    if(sum > max){
                        max = sum;
                    }
                }
            }
        }
        return max;
    }
}

贪心法 相对于暴力简直快的飞起

贪心准则:遍历整个数组,逐一求和sum.当sum <= 0 时,对后续子序列和不是正收益,直接舍弃,同时用max记录sum的最大值.

class Solution {
    public int maxSubArray(int[] nums) {
        int max = -2147483648;//避免干扰设置成最小
        int sum = 0;
        for(int i : nums){
            if(sum > 0){
                sum += i;
            }else{
                sum = i;
            }
            max = max > sum ? max : sum;
            
        }
        return max;
    }
}

学习了大佬们给出的动态规划法 感觉跟贪心法一个思路,只不过是把sum求和结果放在nums上了

class Solution {
    public int maxSubArray(int[] nums) {
        int point = nums[0];
        for(int i = 1;i < nums.length;i++){
            if(point > 0 ){
                nums[i] += point;
            }
            point = nums[i];
        }
        return Arrays.stream(nums).max().getAsInt();
    }
}

哈尔滨理工 校园网 公网ipv6教程

校园网支持ipv6,上联单位为cernet2黑龙江省结点,使用isatap隧道技术接入。

经测试获取到的是公网的ipv6!!甚至没有封禁关键端口

linux下操作 我用发行版是manjaro 其他的发行版也行 用对应的工具安装isatapd即可

[dragonfsky@dragonfsky-mi ~]$ sudo pacman -S  isatapd
[dragonfsky@dragonfsky-mi ~]$ sudo isatapd 192.168.254.250
isatapd[72459]: interface is0 up 出现如下提示时即可获得教育网的公网ipv6地址

windows下操作

Dos下输入netsh
          Interface  ipv6  isatap
          set  router  192.168.254.250
          set  state enable
          exit