1.IDEA相关(含本地部署)
1.1 本地调试时,spring项目配置如下:
step1: 需将webapp下的WEB-INF下的web.xml配置好,并引入此处

web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>spring-elasticsearch-demo</display-name>
<!--配置springmvc-->
<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--配置初始化参数-->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
<!--配置启动的优先级-->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
step2:项目对应的war包

step3

step4

step5

step6:输入ip,端口及controller层的mapping即可
http://localhost:8080/es/index
1.2 使用技巧
1.2.1 设置创建新工程时, maven默认配置

1.2.2 设置创建新工程时, 编码默认配置

1.2.3 设置当前窗口展示class信息

1.3 相关插件
#Alibaba Java Coding Guidelines
# BashSupport
# FindBugs-IDEA-1.0.1
# junitGenerator V2.0插件
# lombok-plugin-0.19-2018.EAP
# markdown-182.2371
# mavenHelper
# VisualVMLauncher
# Git
# jclasslib bytecode viewer(可视化的字节码查看插件, jvm指令查看)
# Stack trace to UML
# sequencediagram (时序图插件, 解读源码必备)
1.3.1 VisualVM Launcher



1.3.2 Alibaba Java Coding Guidelines


1.4 问题
idea中提示mvn无法使用
在idea的安装目录下, 找到D:\IntelliJIDEA\IntelliJ IDEA 2018.2.2\plugins\maven\lib\maven3\bin路径, 复制该路径到环境变量的path中, 即可使用
idea下启动tomcat发现乱码
# vmoptions ---> -Dfile.encoding=UTF-8
# 在idea的安装目录下, 2个vmoptions文件(idea.exe.vmoptions, idea64.exe.vmoptions) ---> -Dfile.encoding=UTF-8
1.5 远程debug(以tomcat为例)
#1.代码层面
保持本地代码和远程服务器上的代码保持一致
#2.catalina.sh
vi /opt/tomcat9/bin/catalina.sh
/JPDA_ADDRESS=8000
在bin目录下执行命令 'sh catalina.sh jpda start'
可以启动tomcat并开启远程调试的端口
https://www.cnblogs.com/qnight/p/8983145.html




然后本地代码打上断点, 本地访问远程url即可, 如 http://192.168.0.199:5005/hello
1.6 class注释模板, 方法模板配置
1.6.1 class注释模板

1.6.2 方法注释模板
https://www.cnblogs.com/lqyy/p/9390441.html (第一步)
https://www.oschina.net/question/2376912_2281059 (第二步)
https://www.cnblogs.com/pcheng/p/10121683.html (方法注释模板)
1.7 IDEA常用快捷键
1.Ctrl+N
按名字搜索类
2.Ctrl+Shift+N
按文件名搜索文件
3.Ctrl+H
查看类的继承关系
4.Ctrl+Alt+B
查看子类方法实现
Ctrl+B可以查看父类或父方法定义,ctrl+鼠标左键也很方便。
5.Alt+F7
查找类或方法在哪被使用
6.Ctrl+F
按照文本的内容在本页查找
7.Ctrl+Shift+F
按照文本的内容全局查找。
8.Shift+Shift
搜索任何东西, 可搜索类、资源、配置项、方法等,还能搜索路径。
其中搜索路径非常实用,例如你写了一个功能叫hello,
在java,js,css,jsp中都有hello的文件夹,
那我们可以搜索"hello/"找到路径中包含hello的文件夹。
9.ctrl + alt +B 或者 Ctrl+Alt+鼠标左键
查看接口的实现类
10.ctrl + alt + <--(左箭头)
回到上一步查看的代码
11.ctrl + alt + -->(右箭头)
回到下一步查看的代码
12.alt + enter
万能键, 补全, 导包等等
13.ctrl + alt + t
try ... catch ... finally
14.ctrl + d
复制
15.ctrl + x
剪切(同删除)
16. ctrl + shift + +/-
+: 表示展开当前类的全部方法(去掉shift表示, 展开当前方法)
-: 表示收缩当前类的全部方法(去掉shift表示, 收缩当前方法)
17.ctrl + F12
查看当前class的所有方法,属性(可以勾选是否包括继承而来的)
18.ctrl + H
查看当前class的子类, 子接口等
19.ctrl + alt + B
查看当前class或者方法的子实现
20.ctrl+alt+u
查看类结构图,这些类都可以点击进入
21.ctrl+shift+alt+u
查看类结构图,这些类不能进入
22.alt+f7
查看方法引用位置
1.8 条件断点
循环中经常用到这个技巧,比如:遍历1个大List的过程中,想让断点停在某个特定值。
参考下图,在断点的位置,右击断点旁边的小红点,会出来一个界面,
在Condition这里填入断点条件即可,这样以debugs模式运行时,就会自动停在i=10的位置

1.9 断点回到"上一步"
该技巧最适合特别复杂的方法套方法的场景,好不容易跑起来,一不小心手一抖,断点过去了,
想回过头看看刚才的变量值,如果不知道该技巧,只能再跑一遍。
#注意
如果想知道为啥这个功能叫Drop Frame,而不是类似Back To Previous 之类的,
可以去翻翻JVM的书,JVM内部以栈帧为单位保存线程的运行状态,
drop frame即扔掉当前运行的栈帧,这样当前“指针”的位置,就自然到了上一帧的位置。

1.10 多线程调试
多线程同时运行时,谁先执行,谁后执行,完全是看CPU心情的,
无法控制先后,运行时可能没什么问题,但是调试时就比较麻烦了,
最明显的就是断点乱跳,一会儿停这个线程,一会儿停在另一个线程。
如果想让线程在调试时,想按自己的愿意来,
让它停在哪个线程就停在哪个线程,可以在图中5个断点的小红点上右击。
即:Suspend挂起的条件是按每个线程来,而非All。把这5个断点都这么设置。


2.Jmeter
#JMeter测试参数说明:
Label:每一个测试单元的名字。
Samples:表示一个测试单元一共发出了多少个请求。
Average:平均响应时间——默认情况下是单个 Request 的平均响应时间,当使用了 Transaction Controller 时,也可以以Transaction 为单位显示平均响应时间。,不重要。
Median:中位数,也就是 50% 用户的响应时间,如果把响应时间从小到大顺序排序,那么50%的请求的响应时间在这个范围之内。重要。
90% Line:90% 用户的响应时间,如果把响应时间从小到大顺序排序,那么90%的请求的响应时间在这个范围之内。重要 。
Min:最小响应时间,不重要。
Max:最大响应时间,出现几率只不过是千分之一甚至万分之一,不重要。
Error%:本次测试中出现错误的请求的数量
Throughput:吞吐量——默认情况下表示每秒完成的请求数(Request per Second),当使用了 Transaction Controller 时,也可以表示类似 LoadRunner 的 Transaction per Second 数
KB/Sec:每秒从服务器端接收 到的数据量(只是接收),相当于LoadRunner中的Throughput/Sec
2.1压力测试
下载地址
http://jmeter.apache.org/download_jmeter.cgi






// data.txt文件内容如下:
tom,21
jerry,22
john,23
trump,24






要测试的java程序


3.Git
git 设置 ssh
当git 安装好后:
#step1:检查是否生成过KEY
打开 git bash 客户端, 输入命令:$ cd ~/.ssh
>> 如果报错: bash: cd: /c/Users/asus/.ssh: No such file or directory, 表示没有生成过 key.
>> 如果显示有 id_rsa.pub 或者 id_dsa.pub 存在,直接进入第step4步开始
#step2:生成key (秘钥)
在git中输入命令:$ ssh-keygen -t rsa -C “你公司在GITLAB上的邮箱地址”,按下回车键
#step3:再次回车即可
#step4:复制秘钥
找到 id_dsa.pub 文件, 一般在 /c/Users/asus/.ssh 下, 也可以借助文件查找工具,全局查找, 复制该文件的全部内容
#step5:在 gitlab 上添加 key
登陆 gitlab 网站:点击头像/账号--Settings--SSH KEYS, 将step4中复制的秘钥粘贴到秘钥框中, 点击 Add key 即可.
https://blog.csdn.net/gufenchen/article/details/95663284 (git-ssh)
3.1 常见命令
#分支操作:
git branch 创建分支
git branch -b 创建并切换到新建的分支上
git checkout 切换分支
git branch 查看分支列表
git branch -v 查看所有分支的最后一次操作
git branch -vv 查看当前分支
git brabch -b 分支名 origin/分支名 创建远程分支到本地
git branch --merged 查看别的分支和当前分支合并过的分支
git branch --no-merged 查看未与当前分支合并的分支
git branch -d 分支名 删除本地分支
git branch -D 分支名 强行删除分支
git branch origin :分支名 删除远处仓库分支
git merge 分支名 合并分支到当前分支上
#暂存操作:
git stash 暂存当前修改
git stash apply 恢复最近的一次暂存
git stash pop 恢复暂存并删除暂存记录
git stash list 查看暂存列表
git stash drop 暂存名(例:stash@{0}) 移除某次暂存
git stash clear 清除暂存
#回退操作:
git reset --hard HEAD^ 回退到上一个版本
git reset --hard ahdhs1(commit_id) 回退到某个版本
git checkout -- file撤销修改的文件(如果文件加入到了暂存区,则回退到暂存区的,如果文件加入到了版本库,则还原至加入版本库之后的状态)
git reset HEAD file 撤回暂存区的文件修改到工作区
#标签操作:
git tag 标签名 添加标签(默认对当前版本)
git tag 标签名 commit_id 对某一提交记录打标签
git tag -a 标签名 -m '描述' 创建新标签并增加备注
git tag 列出所有标签列表
git show 标签名 查看标签信息
git tag -d 标签名 删除本地标签
git push origin 标签名 推送标签到远程仓库
git push origin --tags 推送所有标签到远程仓库
git push origin :refs/tags/标签名 从远程仓库中删除标签
#常规操作:
git push origin test 推送本地分支到远程仓库
git rm -r --cached 文件/文件夹名字 取消文件被版本控制
git reflog 获取执行过的命令
git log --graph 查看分支合并图
git merge --no-ff -m '合并描述' 分支名 不使用Fast forward方式合并,采用这种方式合并可以看到合并记录
git check-ignore -v 文件名 查看忽略规则
git add -f 文件名 强制将文件提交
git fetch:相当于是从远程获取最新版本到本地,但不会自动 merge
git pull:相当于是从远程获取最新版本并 merge 到本地
#git创建项目仓库:
git init 初始化
git remote add origin url 关联远程仓库
git pull
git fetch 获取远程仓库中所有的分支到本地
#忽略已加入到版本库中的文件:
git update-index --assume-unchanged file 忽略单个文件
git rm -r --cached 文件/文件夹名字 (. 忽略全部文件)
#取消忽略文件:
git update-index --no-assume-unchanged file
#拉取、上传免密码:
git config --global credential.helper stor
3.2 代码提交
3.2.1 IDEA中如何进行GIT分支合并 (rebase)
假设目前已有本地分支是 Feature20200224, 想将本地分支推送到
远程分支 Feature20200224 后, 合并到远程分支Dev20200224上.
步骤如下:
#step1.检出远程分支origin/Dev20200224到本地
工程上右键-->Git-->Repository-->Branches-->Remote Branches-->origin/Dev20200224-->输入新的本地分支名Dev20200224(默认即为该名称)
#step2.将本地分支由Feature20200224变基/切换到Dev20200224
工程上右键-->Git-->Repository-->Rebase-->
>> Branche: Dev20200224, Interactive(打钩)
>> Onto: refs/remotes/origin/Dev20200224
>> show Remote Branches (打钩)
#step3.将远程分支Dev20200224上的更改合并到本地分支Dev20200224 (先确保本地分支是Dev20200224)
工程上右键-->Git-->Repository-->
#step4.将远程分支Feature20200224上的更改Merge到本地分支Dev20200224
工程上右键-->Git-->Repository-->Branches-->Remote Branches-->origin/Feature20200224-->Merge into current
#step5.将本地分支Dev20200224推送到远程分支Dev20200224上
工程上右键-->Git-->Repository-->Push






https://blog.csdn.net/fengfengchen95/article/details/82910308
3.2.2 git代码回退 (reset)
3.2.2.1 回退方法1



3.2.2.1 回退方法2


3.3常见问题
3.3.1 pull 代码时提示下述情景
pull的时候提示:You have not concluded your merge (MERGE_HEAD exists).
Exiting because of unfinished merge.
#问题分析
1.问题所在:fetch是将主分支上的所有的代码都down下来,但不会自动合并。
2.解决方案:
① 保存本地代码
② 执行git fetch --all
③ 执行git reset --hard origin/master ----> git reset 把HEAD指向刚刚下载的最新的版本
④pull主分支下的代码
⑤解决冲突,然后提交代码到自己的分支那里






3.3.2 使用 TortoiseGit 客户端时, 如果 git 的账号密码改变, 再操作时会提示无权限
#修改方式, 以控制面板\所有控制面板项\凭据管理器
3.3.3 your local changes would be overwritten by merge. Commint, stash or revert them to proceed.
step1: 储存自己的修改
Git --> Repository --> Stash Changes...
step2: pull代码
Git --> Repository --> Pull
step3: 取出自己的修改
Git --> Repository --> UnStash Changes...
step4: 然后是 commit, push

4.SVN
5.反编译工具
1. IDEA反编译 (推荐)
2. jd-jui
3. JAD
5.1 JD-JUI
5.1.1 将jar包中的.class文件转为 .java源文件
#step1:
file-->open file-->打开对应的jar包即可
#step2:
file-->save all sources
6.Arthas
https://alibaba.github.io/arthas/
7.各种在线转换工具
7.1 ASCII码, JSON, 进制等各种转换
https://www.sojson.com/ascii.html
http://www.dmd5.com/# (MD5在线解析)
8.Notepad++
8.1 NppFtp插件(可远程连接Linux)安装
#1.安装
在 "插件"--> "管理" --> "可用" 中搜索 "NppFtp" --> 点击下载-->完成后重启.
如果下载失败, 注意 windows 防火墙要允许 notepad++ 通过.
#2.使用
"插件" --> NppFtp --> Show NppFtp window

8.2 其他常用插件
compare (文件对比插件)
参考资源
https://blog.csdn.net/guoyuannan/article/details/77168387
网友评论