diff --git a/2022.6版ppt.zip b/2022.6版ppt.zip new file mode 100644 index 0000000..bb05d16 Binary files /dev/null and b/2022.6版ppt.zip differ diff --git a/Git规范.png b/Git规范.png new file mode 100644 index 0000000..887a4a2 Binary files /dev/null and b/Git规范.png differ diff --git a/gitlab/gitlab配置.txt b/gitlab/gitlab配置.txt new file mode 100644 index 0000000..a75fc91 --- /dev/null +++ b/gitlab/gitlab配置.txt @@ -0,0 +1,37 @@ +Thank you for installing JiHu GitLab! +GitLab was unable to detect a valid hostname for your instance. +Please configure a URL for your JiHu GitLab instance by setting `external_url` +configuration in /etc/gitlab/gitlab.rb file. +Then, you can start your JiHu GitLab instance by running the following command: + sudo gitlab-ctl reconfigure + +For a comprehensive list of configuration options please see the Omnibus GitLab readme +https://jihulab.com/gitlab-cn/omnibus-gitlab/-/blob/main-jh/README.md + +Help us improve the installation experience, let us know how we did with a 1 minute survey: +https://wj.qq.com/s2/10068464/dc66 + + Verifying : gitlab-jh-15.0.3-jh.0.el7.x86_64 1/1 + +Installed: + gitlab-jh.x86_64 0:15.0.3-jh.0.el7 + +Complete! + + + + + + + +============================================================================================================================ +Notes: +Default admin account has been configured with following details: +Username: root +Password: You didn't opt-in to print initial root password to STDOUT. +Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours. + +NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password. + + +帐号root密码root123456 \ No newline at end of file diff --git a/git代码分支操作.md b/git代码分支操作.md new file mode 100644 index 0000000..c10ff87 --- /dev/null +++ b/git代码分支操作.md @@ -0,0 +1,11 @@ +环境test、master + +### 正常操作 + +1. 从test上拉取自己的分支test-name,用于开发指定的需求功能。尽力解耦,不用其他不在master环境功能。 +2. 开发完成后将自己本地test分支更新,并将test-name合并到test并pull,此时也可以pull自己的分支name-test, +3. 如果需要自己的需求单独上master此时将name-test合并到master,而不是合并test此时test可能有其他不健全功能。 + +### 单独修改masterbug + +1. 从master拉取分支修改bug-master,修改完成后bug-master合并到test测试,测试完成之后,将bug-master合并到master上 diff --git a/git和前端代码规范.pptx b/git和前端代码规范.pptx new file mode 100644 index 0000000..052a1eb Binary files /dev/null and b/git和前端代码规范.pptx differ diff --git a/javaagent.md b/javaagent.md new file mode 100644 index 0000000..a210ac0 --- /dev/null +++ b/javaagent.md @@ -0,0 +1,19 @@ +## 记录每个方法执行时间 +1.硬编码,该种方式代码侵入性大,复杂度高,不可复用 +2.AOP,该种方式是在运行是进行的,性能损耗较大,可以复用 +3.javassist,该种方式是在虚拟机启动时改变目标对象的字节码,性能损耗小,可以复用 + +## javaagent + +### 依赖 + +### 配置类 + + + +启动vm中配置 + +```shell +-javaagent:/home/shixiaohua/IdeaProjects/fanuc-work/wanliy-server/qms/target/qms-wanliy.jar +``` + diff --git a/jvm/CMS.md b/jvm/CMS.md new file mode 100644 index 0000000..37a7dc7 --- /dev/null +++ b/jvm/CMS.md @@ -0,0 +1,126 @@ +串行垃圾收集器:Serial和Serial Old + +并行收集器:吞吐量优先,Parallel Scanvenge、Parallel Old + +并发收集器:停顿时间优先,CMS、G1 + +## CMS + +Concurrent Mark Sweep + +老年代 + +垃圾收集算法:标记清除算法,不使用复制主要是减少时间。 + +耗时的使用并发标记,不耗时的使用并行标记(STOP WORLD) + +1. 初始标识,标记GC Root 直接关联对象,不用Tracing,速度很快 +2. 并发标识,进行GC Root Tracing + 1. 并发预处理,年轻代指向老年代,一次minor GC后处理 + 2. 可终止的预处理, +3. 重新标识,修改并发标记因用户程序变动的内容 +4. 并发清理,清除不可达对象回收空间,同时有新垃圾产生,留着下次清理称为浮动垃圾 + +### Backgroud CMS + +#### 记忆集 + +跨代收集,用于记录从非收集区域指向收集区域的指针集合的数据结构。 + +#### 卡表 + +记忆集是我们针对跨代引用问题提出的思想,而卡表则是针对于该思想的具体实现。 + +本身就是一个字节数组。 + +CART_TABLE[],每个元素对应着其标识的内存区域一块特定大小的内存块,称为卡页,hostspot使用的卡页是2^9大小,即512字节。 + +一个卡页中包含对个对象,只要有一个对象字段存在跨代指针,其对应的卡表的元素标识就变成1,标识该元素变脏,否则为0。GC时,只要筛选本收集区的卡表中变脏的元素加入GCRoot里。 + +### Foreground CMS + +并发失败才会走这种模式 + +CMS标记压缩算法----MSC(Mark Sweep Compact) + +### 三色标记 + +通俗讲解标记过程。 + +黑色:对象已经被垃圾回收扫描过,且所有对象已经被垃圾回收扫描过 + +灰色:对象已经被垃圾回收扫描过,但这个对象上至少存在一个引用还没有被扫描。 + +白色:对象未被垃圾收集器访问过。 + +### RSet (RemeberSet)引用集 + +处理老年代指向新生代,新生代指向老年代。 + +两种方式记录引用关系 + +obj1.方法=obj2 + +point out 记录obj1所在的Region所对应的Rset记录的是obj2的位置 + +point in 在obj2所在的Rset记录obj1的位置 + +cup缓存行128字节 + +hostsport 卡页 512字节 128*512=64k + +#### 写屏障的内存伪共享问题 + +问题: + +​ 如果不同线程对对象引用的更新操作,恰好位于同一个63KB区域内,这将导致同时更新卡表的同一个缓存行,从而造成缓存行的写回、无效化或者同步操作,间接影响程序性能。 + +解决方案: + +​ 不采用无条件的写屏障,而是先检查卡表标记,只有当该卡表项未被标记过才将其标记为dirty,这就是JDK7中引入的解决方法,引入了一个新的JVM参数-XX:+UseCondCardMark. + +1. 稀疏表 + 1. 本质上就是一种Hash表,Key是Region的起始地址,Value是一个数据,里面存储的元素是卡表的索引号。 +2. 粗粒度位图 + 1. 当细粒度位图size超过阈值时,所有region形成一个bitMap。如果有region对当前Region有指针指向,就设置器对应的bit为1,也就是粗粒度位图。 +3. 细粒度位图 + 1. 就是一个C位图,但是这个位图,可以详细的记录我们的内存变化,包括并发标记修改,对应元素标识等 + 2. 当稀疏表指定region的card数量超过阈值时,则在细粒度位图中创建一个对应的PerRegionTable对象。 + 3. 一个Region地址链表,维护当前Region中所有card对应的一个BitMap集合。 + + + +## G1 + +Garbage-first + +1. 内存空间重新定义 +2. 更短的停顿时间 +3. 某种程度上去解决空间碎片 + +时间更短,某种程度可以解决空间碎片。 + +筛选引擎,优先筛选重要的(根据设置时间)。 + +1. Empty Space +2. Eden Space +3. Survivor Space +4. Old Generation +5. Humongous + +### TLAB + +线程本地分配缓冲区Thread Local Allocation Buffer + +分配空间时,为了提高JVM的运行效率,劲量减少临界区范围,避免全局锁。G1的通常的应用场景中,会存在大量的访问器同时执行,为减少锁冲突jvm引入TLAB机制。 + +### 垃圾收集器的三种模式 + +1. young GC +2. mixed GC + +pss队列 + +## ZGC + +Z Garbage Collector \ No newline at end of file diff --git a/spring/springboot/自动装配.md b/spring/springboot/自动装配.md new file mode 100644 index 0000000..4e43a2a --- /dev/null +++ b/spring/springboot/自动装配.md @@ -0,0 +1,11 @@ +## 自动装配 + +@Import + +SPI:MATE-INFO/spring.factories + +1. 加载当前系统下文件中声明的类 +2. 移除重复的类 +3. 移除掉显示排除的 +4. 过滤掉不需要载入的配置类。 + diff --git a/spring/springboot/解读@SpringBootApplication.md b/spring/springboot/解读@SpringBootApplication.md new file mode 100644 index 0000000..c413f65 --- /dev/null +++ b/spring/springboot/解读@SpringBootApplication.md @@ -0,0 +1,6 @@ +## @Import + +```java +Indicates one or more component classes to import ; typically {@link Configuration @Configuration} classes. +``` + diff --git a/spring/自动装配.md b/spring/自动装配.md new file mode 100644 index 0000000..22a9259 --- /dev/null +++ b/spring/自动装配.md @@ -0,0 +1,10 @@ +## 自动装配 + +@Import + +SPI:MATE-INFO/spring.factories + +1. 加载当前系统下文件中声明的类 +2. 移除重复的类 +3. 移除掉显示排除的 +4. 过滤掉不需要载入的配置类。 \ No newline at end of file diff --git a/算法/learn/.gitignore b/算法/learn/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/算法/learn/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/算法/learn/.mvn/wrapper/maven-wrapper.jar b/算法/learn/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..c1dd12f Binary files /dev/null and b/算法/learn/.mvn/wrapper/maven-wrapper.jar differ diff --git a/算法/learn/.mvn/wrapper/maven-wrapper.properties b/算法/learn/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..b7cb93e --- /dev/null +++ b/算法/learn/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/算法/learn/mvnw b/算法/learn/mvnw new file mode 100644 index 0000000..8a8fb22 --- /dev/null +++ b/算法/learn/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/算法/learn/mvnw.cmd b/算法/learn/mvnw.cmd new file mode 100644 index 0000000..1d8ab01 --- /dev/null +++ b/算法/learn/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/算法/learn/pom.xml b/算法/learn/pom.xml new file mode 100644 index 0000000..12b22fa --- /dev/null +++ b/算法/learn/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.6.6 + + + com.learn + learn + 0.0.1-SNAPSHOT + learn + Demo project for Spring Boot + + 1.8 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/算法/learn/src/main/java/com/learn/learn/LearnApplication.java b/算法/learn/src/main/java/com/learn/learn/LearnApplication.java new file mode 100644 index 0000000..03ee3e7 --- /dev/null +++ b/算法/learn/src/main/java/com/learn/learn/LearnApplication.java @@ -0,0 +1,13 @@ +package com.learn.learn; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class LearnApplication { + + public static void main(String[] args) { + SpringApplication.run(LearnApplication.class, args); + } + +} diff --git a/算法/learn/src/main/resources/application.properties b/算法/learn/src/main/resources/application.properties new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/算法/learn/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/算法/learn/src/test/java/com/learn/learn/LearnApplicationTests.java b/算法/learn/src/test/java/com/learn/learn/LearnApplicationTests.java new file mode 100644 index 0000000..2344471 --- /dev/null +++ b/算法/learn/src/test/java/com/learn/learn/LearnApplicationTests.java @@ -0,0 +1,15 @@ +package com.learn.learn; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class LearnApplicationTests { + // 小和问题,数组每个元素左边比他小的数和,最后总体相加 + // merge sort + // 左侧排序,左组小加和。 + @Test + void contextLoads() { + } + +} diff --git a/算法/learn/体系/2.认识复杂度、对数器、二分法.md b/算法/learn/体系/2.认识复杂度、对数器、二分法.md new file mode 100644 index 0000000..fee7a6b --- /dev/null +++ b/算法/learn/体系/2.认识复杂度、对数器、二分法.md @@ -0,0 +1,44 @@ +# 认识复杂度、对数器、二分法或异运算 +1. 时间复杂度 +2. 额外空间复杂度 +3. 常数项,一个操作的执行时间不以具体样本量为转移(数组寻址),每次执行时间都是固定的时间。 +### 时间复杂度 +#### 选择排序 +1. n*(看+比)+1 +2. (n-1)* n*(看+比)+1 +3. (n-2)* n*(看+比)+1 +4. 2*(n+n-1+n-2+····+1)+n 看+比 2 +5. 2an平方+bn+n+c +6. 2an平方 +最高阶,选出最小的,从头开始放。 +#### 冒泡排序 +1. 相邻的两个比较,大的放后面,最大值在后面。 +2. n-1 +3. n-2 +4. n-3 +5. 1 +5. n平方 +#### 插入排序 +1. 最好n +2. 最差n平方 +#### 计算时间复杂度 +1. 按照最坏的情况来 +2. 拆分为一个个基本动作 +3. 如果数据量为n,看基本动作和n之间的关系。 +4. 只把高阶项留下,低阶项和常数项去除。 +### 常数项 +### 最优解 +1. 时间复杂度 +2. 空间复杂度 +#### 常数时间操作 +1. 常见算数操作 +2. 移位、位运算 +3. 复制、比较、自增、自减操作 +4. 数组寻址操作 +#### 非常数时间操作 +1、链表LinkedList +### 对数器 +### 局部最小值 +数据状况和问题本身梳理问题。 +二分排他性 +俩边开始找,根据趋势,二分处理。 \ No newline at end of file diff --git a/算法/learn/体系/3.异或运算相关面试题.md b/算法/learn/体系/3.异或运算相关面试题.md new file mode 100644 index 0000000..34b1f28 --- /dev/null +++ b/算法/learn/体系/3.异或运算相关面试题.md @@ -0,0 +1,3 @@ +## 异或运算 +无进位相加,满足结合律和交换率 + \ No newline at end of file diff --git a/算法/learn/体系/4.一些基础的数据结构.md b/算法/learn/体系/4.一些基础的数据结构.md new file mode 100644 index 0000000..0d8e400 --- /dev/null +++ b/算法/learn/体系/4.一些基础的数据结构.md @@ -0,0 +1,54 @@ +1. 单链表、双向链表 +2. 栈队列 +## 数组做队列 +1. 数组固定长度,两个指针追赶。只用一个元素时不好实现。 +2. 添加变量队列元素个数。begin和end解耦。 +## 栈随时获取最小值 +1. 数据栈 +2. 最小栈(弹出后依然能获取最小值) +3. 压栈,数据栈正常压入,最小栈如果压入数小于栈顶则亚如当前数,如果大于则重复压入栈顶。 +4. 弹出同步弹出。 + +## 图优先遍历 +深度优先遍历:栈 +宽度优先遍历:队列 +## 栈实现队列 +1. 设置push栈和pop栈,两个来回倒,push压入,弹出时push中的数据放入pop中,从pop中弹出。(一次性倒完,) +## 队列实现栈 +1. 压栈放入一个队列中,需要弹栈的时候将全部放入另一个队列中,留下最后一个弹出。 +2. 再次放入,再放在当前队列中存入,弹出的时候,再次导入另一个队列中,最后一个弹出。 +## 递归 +### 递归改非递归 +使用系统栈。树遍历。 +递归到动态规划。 +大化小,递归图。 +## Master公式分析递归时间复杂度 +子问题规模一致 +## 哈希表 HashMap +## 有序表 TreeMap +## 归并排序 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/算法/learn/体系/5.归并排序及相关面试题.md b/算法/learn/体系/5.归并排序及相关面试题.md new file mode 100644 index 0000000..c190ee4 --- /dev/null +++ b/算法/learn/体系/5.归并排序及相关面试题.md @@ -0,0 +1,6 @@ +## 递归排序 +1. 归并分两边排序 +2. 合并,左右比较放入一个新的数据做那个 +## 归并 +1. 步长从1开始增加到数组长度。 +2. merge sort 把需要比较的数据变成有序的信息。 \ No newline at end of file diff --git a/算法/learn/体系/6.归并排序附加题、随机快速排序.md b/算法/learn/体系/6.归并排序附加题、随机快速排序.md new file mode 100644 index 0000000..e435768 --- /dev/null +++ b/算法/learn/体系/6.归并排序附加题、随机快速排序.md @@ -0,0 +1 @@ +52:28 \ No newline at end of file diff --git a/算法/learn/体系/img/常数时间.png b/算法/learn/体系/img/常数时间.png new file mode 100644 index 0000000..1d9c694 Binary files /dev/null and b/算法/learn/体系/img/常数时间.png differ diff --git a/算法/learn/体系/img/归并merge.png b/算法/learn/体系/img/归并merge.png new file mode 100644 index 0000000..8be85ef Binary files /dev/null and b/算法/learn/体系/img/归并merge.png differ diff --git a/算法/learn/体系/img/手写/2.认识复杂度.jpg b/算法/learn/体系/img/手写/2.认识复杂度.jpg new file mode 100644 index 0000000..ad06d8d Binary files /dev/null and b/算法/learn/体系/img/手写/2.认识复杂度.jpg differ diff --git a/算法/learn/体系/img/算法复杂度.png b/算法/learn/体系/img/算法复杂度.png new file mode 100644 index 0000000..a6f7980 Binary files /dev/null and b/算法/learn/体系/img/算法复杂度.png differ diff --git a/规范.png b/规范.png new file mode 100644 index 0000000..11f6975 Binary files /dev/null and b/规范.png differ