首页 » Latest Post

对于webpack项目,debug方式很简单

1.打开config/index.js,找到这一行

devtool: 'cheap-module-eval-source-map',

2.改为:

 devtool: '#eval-source-map ',

2.然后想加断点的地方写上,即可

debugger

Error processing "launch": Error: Can't find Chrome

1.完整报错

Error processing "launch": Error: Can't find Chrome - install it or set the "runtimeExecutable" field in the launch config.
    at Object.errP (/home/shenfeng/.vscode/extensions/msjsdiag.debugger-for-chrome-4.11.3/node_modules/vscode-chrome-debug-core/out/src/utils.js:262:13)
    at ChromeDebugAdapter.<anonymous> (/home/shenfeng/.vscode/extensions/msjsdiag.debugger-for-chrome-4.11.3/out/src/chromeDebugAdapter.js:69:57)
    at Generator.next (<anonymous>)
    at /home/shenfeng/.vscode/extensions/msjsdiag.debugger-for-chrome-4.11.3/out/src/chromeDebugAdapter.js:10:71
    at new Promise (<anonymous>)
    at __awaiter (/home/shenfeng/.vscode/extensions/msjsdiag.debugger-for-chrome-4.11.3/out/src/chromeDebugAdapter.js:6:12)
    at launch.then (/home/shenfeng/.vscode/extensions/msjsdiag.debugger-for-chrome-4.11.3/out/src/chromeDebugAdapter.js:52:74)

2.这个是因为找不到chrome,用pacman查找位置

pacman -Ql google-chrome

3.lanch.json 配置

"runtimeExecutable": "/usr/bin/google-chrome-stable",

spring 自带的mongoRepository ,只能replace更新,即全量更新,我们可以自定义一个repository 方法。来做部分更新

1.解决思路就是生成一个map,对map中不为空的key生成update查询

Map<String, Object> objectMap = user.toMap();
    objectMap.values().removeIf(Objects::isNull);
    Update update = new Update();
    objectMap.forEach(update::set);

    return mongoOperations.findAndModify(
            Query.query(Criteria.where("_id").is(user.getId())), update, User.class);

2.而转换成map,可以用spring自带的jackson

ObjectMapper m = new ObjectMapper();
Map<String,Object> props = m.convertValue(myBean, Map.class);

3.需要注意的,对于基本类型的字段,有默认值的,所以推荐使用Object类型,如别用int 用Integer。null不占用mongodb的空间,即不会存储。所以从这方面也是好的。全部代码如下,注意笔者用的Reative版:

 public Mono<UpdateResult> updatePartial(MySeries mySeries) {
        if (null == mySeries || null == mySeries.getSrcId()) {
            return null;
        }
        ObjectMapper m = new ObjectMapper();
        Map<String, Object> objectMap = m.convertValue(mySeries, Map.class);
        objectMap.values().removeIf(o -> {
            if (null == o) {
                return true;
            }
            var cls = o.getClass();
            if (cls == ArrayList.class && ((ArrayList) o).size() <= 0) {
                return true;
            }
            if (cls == String.class && StringUtils.isEmpty(o)) {
                return true;
            }
      
            return false;
        });
        Update update = new Update();
        objectMap.forEach(update::set);
        Query q = new Query();
        q.addCriteria(Criteria.where("srcId").is(mySeries.getSrcId()));
        return template.updateFirst(q, update, MySeries.class);

    }

本文介绍一些基本的jvm信息查看命令.JDK自带了一些工具可以查看,数字是pid是

1.jcmd -l查看所有的java 进程

jcmd -l
15152 org.jetbrains.kotlin.daemon.KotlinCompileDaemon --daemon-runFilesPath /home/shenfeng/.local/share/kotlin/daemon --daemon-autoshutdownIdleSeconds=7200 --daemon-compilerClasspath /home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Kotlin/kotlinc/lib/kotlin-compiler.jar
15203 org.jetbrains.jps.cmdline.Launcher /home/shenfeng/Tools/idea-IU-183.5912.21/lib/javac2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-impl-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/idea_rt.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-buffer-4.1.30.Final.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jna-platform.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/lz4-1.3.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-lang3-3.4.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-transport-http-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-logging-1.2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-builder-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-builders-6.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/nanoxml-2.2.3.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/resources_en.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jdom.jar:/home/shenfeng/
32741 org.jetbrains.jps.cmdline.Launcher /home/shenfeng/Tools/idea-IU-183.5912.21/lib/javac2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-impl-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/idea_rt.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-buffer-4.1.30.Final.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jna-platform.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/lz4-1.3.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-lang3-3.4.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-transport-http-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-logging-1.2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-builder-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-builders-6.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/nanoxml-2.2.3.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/resources_en.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jdom.jar:/home/shenfeng/
3574 /home/shenfeng/Tools/charles/bin/../lib/charles.jar
1352 org.jetbrains.jps.cmdline.Launcher /home/shenfeng/Tools/idea-IU-183.5912.21/lib/javac2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-impl-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/idea_rt.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-buffer-4.1.30.Final.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jna-platform.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/lz4-1.3.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-lang3-3.4.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-transport-http-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-logging-1.2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-builder-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-builders-6.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/nanoxml-2.2.3.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/resources_en.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jdom.jar:/home/shenfeng/
15210 com.tddlmj.web.WebApplication --enableCrawl=true --server.port=8787
15323 sun.tools.jcmd.JCmd -l
12251 com.intellij.idea.Main

2.查看进程3574的启动时间

jcmd 3574 VM.uptime
3574:
248081.860 s

3.查看System.getPropertites条目,也可以用jinfo -sysprops process_id

jcmd 15805 VM.system_properties
15805:
#Thu May 23 14:43:51 CST 2019
java.vendor=Oracle Corporation
preload.project.path=/home/shenfeng/dev/rstar/rStar-dataWash
sun.java.launcher=SUN_STANDARD
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
sun.nio.ch.bugLevel=
idea.config.path=/home/shenfeng/.IntelliJIdea2018.3/config
idea.paths.selector=IntelliJIdea2018.3
kotlin.daemon.client.alive.path="/tmp/kotlin-idea-7727541766871982555-is-running"
jnidispatch.path=/home/shenfeng/.IntelliJIdea2018.3/system/compile-server/datawash_a4de10e5/_temp_/jna--632901258/jna4835071230586300281.tmp
os.name=Linux
sun.boot.class.path=/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar\:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar\:/usr/lib/jvm/java-8-openjdk/jre/lib/sunrsasign.jar\:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar\:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar\:/usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar\:/usr/lib/jvm/java-8-openjdk/jre/lib/jfr.jar\:/usr/lib/jvm/java-8-openjdk/jre/classes
idea.plugins.path=/home/shenfeng/.IntelliJIdea2018.3/config/plugins
java.vm.specification.vendor=Oracle Corporation
java.runtime.version=1.8.0_202-b26
jna.loaded=true
io.netty.serviceThreadPrefix=Netty
user.name=shenfeng
kotlin.incremental.compilation=true
idea.home.path=/home/shenfeng/Tools/idea-IU-183.5912.21
user.language=en
jdt.compiler.useSingleThread=true
sun.boot.library.path=/usr/lib/jvm/java-8-openjdk/jre/lib/amd64
java.version=1.8.0_202
user.timezone=Asia/Shanghai
java.net.preferIPv4Stack=true
kotlin.daemon.enabled=
sun.arch.data.model=64
io.netty.initialSeedUniquifier=-3110358786008209641
java.endorsed.dirs=""
sun.cpu.isalist=
sun.jnu.encoding=UTF-8
file.encoding.pkg=sun.io
file.separator=/
java.specification.name=Java Platform API Specification
java.class.version=52.0
user.country=US
java.home=/usr/lib/jvm/java-8-openjdk/jre
java.vm.info=mixed mode
os.version=4.19.30-1-MANJARO
path.separator=\:
java.vm.version=25.202-b26
jps.fallback.jdk.version=1.8.0_152-release
java.awt.printerjob=sun.print.PSPrinterJob
sun.io.unicode.encoding=UnicodeLittle
awt.toolkit=sun.awt.X11.XToolkit
jps.log.dir=/home/shenfeng/.IntelliJIdea2018.3/system/log/build-log
io.netty.processId=58698
user.home=/home/shenfeng
java.specification.vendor=Oracle Corporation
java.library.path=/usr/java/packages/lib/amd64\:/usr/lib64\:/lib64\:/lib\:/usr/lib
java.vendor.url=http\://java.oracle.com/
jps.fallback.jdk.home=/home/shenfeng/Tools/idea-IU-183.5912.21/jre64
java.vm.vendor=Oracle Corporation
java.runtime.name=OpenJDK Runtime Environment
sun.java.command=org.jetbrains.jps.cmdline.Launcher /home/shenfeng/Tools/idea-IU-183.5912.21/lib/javac2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-impl-1.1.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/idea_rt.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-buffer-4.1.30.Final.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jna-platform.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-3.3.9.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/lz4-1.3.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-lang3-3.4.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-transport-http-1.1.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-logging-1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-builder-3.3.9.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-builders-6.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/nanoxml-2.2.3.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/resources_en.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jdom.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-resolver-4.1.30.Final.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/forms-1.1-preview.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jna.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/protobuf-java-3.4.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-api-1.1.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-transport-4.1.30.Final.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-codec-4.1.30.Final.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-builders.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-aether-provider-3.3.9.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-builder-support-3.3.9.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-spi-1.1.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/log4j.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-model.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-connector-basic-1.1.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-util-1.1.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/util.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/slf4j-api-1.7.25.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-artifact-3.3.9.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/trove4j.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/oro-2.0.8.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/plexus-interpolation-1.21.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-common-4.1.30.Final.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-dependency-resolver.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-transport-file-1.1.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/httpcore-4.4.10.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/annotations.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-codec-1.10.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/httpclient-4.5.6.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/plexus-utils-3.0.22.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/platform-api.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/guava-25.1-jre.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/asm-all-7.0.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-repository-metadata-3.3.9.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/plexus-component-annotations-1.6.jar\:\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/gson-2.8.5.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/jarutils.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/guava-25.1-jre.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/common-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/manifest-merger-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/sdk-common-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/builder-model-3.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/builder-test-api-3.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/ddmlib-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/repository-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/gradle/lib/gradle-api-4.10.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/gson-2.8.5.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/jarutils.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/guava-25.1-jre.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/common-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/manifest-merger-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/sdk-common-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/builder-model-3.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/builder-test-api-3.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/ddmlib-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/repository-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/gradle/lib/gradle-api-4.10.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/uiDesigner/lib/jps/ui-designer-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/IntelliLang/lib/intellilang-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Groovy/lib/groovy-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Groovy/lib/groovy-rt-constants.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/eclipse/lib/eclipse-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/eclipse/lib/common-eclipse-util.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/maven/lib/maven-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/aspectj/lib/aspectj-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/gradle/lib/gradle-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/devkit/lib/devkit-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/JavaEE/lib/javaee-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/JavaEE/lib/jps/jpa-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/jps/android-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/android-common.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/build-common.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/android-rt.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/sdklib.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/common-26.1.2.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/jarutils.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/android/lib/layoutlib-api.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/javaFX/lib/javaFX-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/javaFX/lib/common-javaFX-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Kotlin/lib/kotlin-stdlib.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Kotlin/lib/kotlin-reflect.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Kotlin/lib/kotlin-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Kotlin/lib/android-extensions-ide.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/Kotlin/lib/android-extensions-compiler.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/flex/lib/flex-jps-plugin.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/plugins/flex/lib/flex-shared.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/scala-library.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/compiler-shared.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/jps/nailgun.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/jps/compiler-jps.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/jps/sbt-interface.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/jps/incremental-compiler.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/scala-library.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/lib/scala-play-2-jps-plugin.jar\:/home/shenfeng/.IntelliJIdea2018.3/config/plugins/Scala/launcher/sbt-launch.jar org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 41593 de52788b-9f2a-4f95-9740-5cda56887d40 /home/shenfeng/.IntelliJIdea2018.3/system/compile-server
java.class.path=/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-launcher.jar\:/usr/lib/jvm/java-8-openjdk/lib/tools.jar\:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/optimizedFileManager.jar
io.netty.machineId=28\:f0\:76\:ff\:fe\:16\:65\:0e
java.vm.specification.name=Java Virtual Machine Specification
jps.backward.ref.index.builder=true
java.vm.specification.version=1.8
preload.config.path=/home/shenfeng/.IntelliJIdea2018.3/config/options
sun.cpu.endian=little
sun.os.patch.level=unknown
java.awt.headless=true
java.io.tmpdir=/home/shenfeng/.IntelliJIdea2018.3/system/compile-server/datawash_a4de10e5/_temp_
java.vendor.url.bug=http\://bugreport.sun.com/bugreport/
jna.platform.library.path=/usr/lib64\:/lib64\:/usr/lib\:/lib\:/usr/lib32\:/usr/lib/libfakeroot
os.arch=amd64
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
java.ext.dirs=/usr/lib/jvm/java-8-openjdk/jre/lib/ext\:/usr/java/packages/lib/ext
rebuild.on.dependency.change=true
user.dir=/home/shenfeng/.IntelliJIdea2018.3/system/compile-server
line.separator=\n
java.vm.name=OpenJDK 64-Bit Server VM
file.encoding=UTF-8
java.specification.version=1.8
compile.parallel=false
io.netty.noUnsafe=true

3.JVM版本

jcmd 15805 VM.version
15805:
OpenJDK 64-Bit Server VM version 25.202-b26
JDK 8.0_202

4.JVM启动参数


jcmd 15805 VM.command_line
15805:
VM Arguments:
jvm_args: -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs="" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=/home/shenfeng/dev/rstar/rStar-dataWash -Dpreload.config.path=/home/shenfeng/.IntelliJIdea2018.3/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=-3110358786008209641 -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US -Didea.paths.selector=IntelliJIdea2018.3 -Didea.home.path=/home/shenfeng/Tools/idea-IU-183.5912.21 -Didea.config.path=/home/shenfeng/.IntelliJIdea2018.3/config -Didea.plugins.path=/home/shenfeng/.IntelliJIdea2018.3/config/plugins -Djps.log.dir=/home/shenfeng/.IntelliJIdea2018.3/system/log/build-log -Djps.fallback.jdk.home=/home/shenfeng/Tools/idea-IU-183.5912.21/jre64 -Djps.fallback.jdk.version=1.8.0_152-release -Dio.netty.noUnsafe=true -Djava.io.tmpdir=/home/shenfeng/.IntelliJIdea2018.3/system/compile-server/datawash_a4de10e5/_temp_ -Djps.backward.ref.index.builder=true -Dkotlin.incremental.compilation=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path="/tmp/kotlin-idea-7727541766871982555-is-running" 
java_command: org.jetbrains.jps.cmdline.Launcher /home/shenfeng/Tools/idea-IU-183.5912.21/lib/javac2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-impl-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/idea_rt.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-buffer-4.1.30.Final.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jna-platform.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/lz4-1.3.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-lang3-3.4.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-transport-http-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/commons-logging-1.2.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-model-builder-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-builders-6.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/nanoxml-2.2.3.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/resources_en.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jdom.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-resolver-4.1.30.Final.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/forms-1.1-preview.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jna.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/protobuf-java-3.4.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-api-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-transport-4.1.30.Final.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/netty-codec-4.1.30.Final.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-builders.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-aether-provider-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/maven-builder-support-3.3.9.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-spi-1.1.0.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/log4j.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-model.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/aether-connector-basic-1.1.0.jar:/home/shenfeng/To
java_class_path (initial): /home/shenfeng/Tools/idea-IU-183.5912.21/lib/jps-launcher.jar:/usr/lib/jvm/java-8-openjdk/lib/tools.jar:/home/shenfeng/Tools/idea-IU-183.5912.21/lib/optimizedFileManager.jar
Launcher Type: SUN_STANDARD

5.打印JVM调优标志

jcmd 15805 VM.flags
15805:
-XX:CICompilerCount=4 -XX:InitialHeapSize=262144000 -XX:MaxHeapSize=734003200 -XX:MaxNewSize=244318208 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=87031808 -XX:OldSize=175112192 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 

我们在做网站时,怎么布局结构才符合爬虫的口味,或者html5规范呢。

1.如下:

<header>
  <nav></nav>
</header>
<main>
  <article>
    <section></section>
    <section></section>
  </article>
  <aside>
  </aside>
</main>
<footer></footer>

2.说明如下:

  • main只能出现一次。注意main内不要直接嵌套section
  • article一般是整个页面的主要内容
  • section,类似于文章的章节。section内可以嵌套独立内容的article
  • aside是对article的相关补充
  • footer一般是网站的其他内容,如版权,作者,地址。也可以包含nav

3.最终效果:
最终结构

参考文章链接: https://www.semrush.com/blog/semantic-html5-guide/