主页

CentOS 修改主机名

老版本123/etc/hosts/etc/sysconfig/networkhostname dev996CentOS712345# hostnamectl set-hostname [new hostname]修改完需要重启服务# systemctl restart systemd-hostnamed重启服务后,需要重新连接才会显示新的hostname

Git Branch

git branch 命令是用来管理分支的,可以创建、删除、修改和查询分支。官网资料:https://git-scm.com/docs/git-branch命令中的参数,–为全称,单-的参数都是缩写,参数大小写是有区别的,一般大写为强制,等同于-f。查询分支列出本地分支列表中当前分支前面有*标记123git branch --listgit branch -lgit branch列出远程分支12git branch --remotesgit branch -r

Java请求RapNet接口查询钻石价格

RapNet的账号开通在国内需要联系香港的办公室,具体信息:Hong Kong & China+852-2805-2620hk@diamonds.net获取钻石价格需要2个接口,一个获取钻石列表,另一个获取钻石的详细信息。通过WebServer获取这种方式除了上面的2个接口外还需要一个接口获取ticket,请求和处理返回值都相对比较麻烦,就放弃了。获取JSON格式数据每次请求携带用户、密码和查询参数,服务端返回json格式的字符串。Java代码:

学生机 躺枪了

刚刚WordPress群里发生的对话,新鲜热乎的。12345678910111213141516171819卖主机的:腾讯云学生机卖主机的:有要的没路人1:5毛钱就要管理员:(截图了一个刚进群妹子的个人资料,并且里面有4张个人照)路人2:这群要炸了路人3:射交群?路人3:100秒了妹子:神经病啊路人4:活好?妹子:有病啊,一个个跟狗似的?卖主机的:学生机妹子:就会约炮?卖主机的:有没有要的妹子:你

Java获取微信企业号中的手机号码

在开发的项目中,有工作流审批功能,有些岗位的人员并不是一直在办公室的,这就需要在手机端审批。手机端是在企业号中的应用实现的,登录时需要获取企业员工的手机号,具体代码如下:

Spring MVC Interceptor 实现性能监控

利用Spring MVC 的 Interceptor 实现个简易的性能监控,计算一下每个url的执行时间。在 preHandle 方法中记录当前的时间戳到线程局部变量里,然后在afterCompletion方法中,用当前的时间戳剪掉线程局部变量里的时间戳得出个运行时间,并记录到log里。这只是个简易的性能监控,如果想长期正式的监控性能,请选择其它成熟的产品。Interceptor1234567891011121314151617181920212223242526272829303132333435363738import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.core.NamedThreadLocal;import org.springframework.web.servlet.HandlerInterceptor;import org.springframework.web.servlet.ModelAndView;public class PerformanceInterceptor implements HandlerInterceptor { private final static Logger LOGGER = LoggerFactory.getLogger(PerformanceInterceptor.class); private NamedThreadLocal<Long> startTimeThreadLocal = new NamedThreadLocal<Long>("performance"); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { startTimeThreadLocal.set(System.currentTimeMillis()); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { return; } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { long currentTime = System.currentTimeMillis(); long executeTime = currentTime - startTimeThreadLocal.get(); LOGGER.info("uri:{} 执行了 {} 毫秒", request.getRequestURI(), executeTime); }}

Spring Data JPA 通过 Query DSL查询数据

昨天写 JPA的查询方式,里面关于QueryDSL的部分没有写,当时因为一直报错,现在错误解决了,补上 Spring Data JPA 通过 Query DSL 查询的实现。另2篇:Spring Data JPA 的查询方式You need to run build with JDK or have tools.jar on the classpathpom123456789101112131415<dependency> <groupId>com.querydsl</groupId> <artifactId>querydsl-apt</artifactId></dependency><dependency> <groupId>com.querydsl</groupId> <artifactId>querydsl-jpa</artifactId></dependency><dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.7</version> <scope>system</scope> <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath></dependency>官网和一些其他示例并没有提及tools,但没有这个会报错的,IDE里面就报了。除了上面的配置还要添加构建插件

You need to run build with JDK or have tools.jar on the classpath

在配置QueryDSL的时候报的这个错误,在 stackoverflow.com 上找到了2个questions,按里面给出的答案修改后可用。https://stackoverflow.com/questions/27619304/you-need-to-run-build-with-jdk-or-have-tools-jar-on-the-classpathhttps://stackoverflow.com/questions/24482259/eclipse-issue-with-maven-build-and-jdk-when-generating-qclasses-in-querydsl报错信息1234567891011121314151617181920212223242526272829303132You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure you run eclipse under JDK as well (com.mysema.maven:apt-maven-plugin:1.1.3:process:default:generate-sources) org.apache.maven.plugin.MojoExecutionException: You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure you run eclipse under JDK as well at com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:362) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at org.eclipse.m2e.core.internal.embedder.MavenImpl $11.call(MavenImpl.java:1362) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at org.eclipse.m2e.core.internal.builder.MavenBuilder $1.method(MavenBuilder.java:172) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86) at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) at org.eclipse.core.internal.events.BuildManager $2.run(BuildManager.java:734) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245) at org.eclipse.core.internal.events.BuildManager $1.run(BuildManager.java:300) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java: 1) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: org.apache.maven.plugin.MojoExecutionException: You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure you run eclipse under JDK as well at com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:310) ... 32 more方案一配置eclipse.ini