开发工具分享
  • 首页
  • 计算科学
  • 文化旅游
  • 项目和网站
    • OSSEZ 计算技术
    • USRealEstate 社区
    • 地区文化
    • CWIKI.US
    • BUG.OSSEZ.COM
    • RSS.OSSEZ.COM
Computer Science
Computer Science

为什么编程中大家都喜欢使用int来代表各种状态和类型常量

用int 效率高,便于转换,便于国际化。 不管怎么样使用中文也好英文也罢,字符占用存储比 int 要多,中文更多了。int 数据库好索引,查询快。 国际化 字符 map 方便。 另外这个是大家都懂的定义,提高代码可读性。要知道你的代码有时候也是要给别人读的。有时候可能看起来不太好的,但是也都是习惯了,更多的惯例就是规定。 https://www.ossez.com/t/int/769  

2020年12月18日 0Comments 823Browse 0Like Read more
Computer Science

Spring Boot API 中文字符乱码

Spring Boot 在运行 API 的时候如果返回数据库的时候提示中文是乱码。 但是针对不同的浏览器,返回的结果是不一样的。 在 Application.yml 中 添加下面的配置: server: servlet: encoding: force: true charset: UTF-8 enabled: true     然后重新启动服务器后,我们所有的访问都会使用 UTF-8 编码。 这样以避免字符集错误。     需要注意的是,不同的浏览器对字符集的编码是不一样的,最好都测一下。 针对手机平台也是不一样的。 https://www.ossez.com/t/spring-boot-api/768

2020年12月14日 0Comments 781Browse 0Like Read more
Computer Science

Logstash-logback-encoder 和 logback 出现错误

获得的错误信息为: Exception in thread "main" java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - A "net.logstash.logback.encoder.LogstashEncoder" object is not assignable to a "ch.qos.logback.core.Appender" variable. ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - The class "ch.qos.logback.core.Appender" was loaded by ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - [jdk.internal.loader.ClassLoaders$AppClassLoader@16f65612] whereas object of type ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - "net.logstash.logback.encoder.LogstashEncoder" was loaded by [jdk.internal.loader.ClassLoaders$AppClassLoader@16f65612]. at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169) at org.springframework.boot.logging.logback.LogbackLoggingSystem.reinitialize(LogbackLoggingSystem.java:222) at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:73) at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60) at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:118) at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:306) at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:281) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:216) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:80) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345) at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at com.ossez.edtestbank.service.Application.main(Application.java:44) 问题和解决 这个是包的兼容性问题。 logback-core 需要设置为 1.2.0 版本,如果你设置了更高的版本的话,你就会遇到上面的问题。 请参考下面链接中的问题: https://jira.qos.ch/browse/LOGBACK-1326 貌似到现在还没有解决。     如果你还希望使用 logstash-logback-encoder 的话,那么需要将 logback 设置为 1.2.0 版本。 https://www.ossez.com/t/logstash-logback-encoder-logback/767

2020年12月14日 0Comments 2643Browse 5Like Read more
Computer Science

Spring Boot Intellij 运行应用的时候 Command line is too long. Shorten command line for 错误

提示的错误信息如下: *Command line is too long*. Shorten *command line* for       解决办法 有下面 2 个方法都可以解决这个问题。 修改应用 首先需要选择 Application,然后选择编辑。 然后通过上面选择 JAR 的配置。       修改 workspace.xml 然后修改 workspace.xml 文件,针对 PropertiesComponent 组件,添加下面的参数: <property name="dynamic.classpath" value="true" />     然后重新启动后就可以解决这个问题了。 https://www.ossez.com/t/spring-boot-intellij-command-line-is-too-long-shorten-command-line-for/763

2020年12月08日 0Comments 768Browse 0Like Read more
Computer Science

Jenkins 在 Linux 上的部署后,默认安装目录

你可能有下面的一些安装目录: /usr/lib/jenkins/:jenkins安装目录,WAR包会放在这里。 /etc/sysconfig/jenkins:jenkins配置文件,“端口”,“JENKINS_HOME”等都可以在这里配置。 /var/lib/jenkins/:默认的JENKINS_HOME。 /var/log/jenkins/jenkins.log:Jenkins日志文件。     https://www.ossez.com/t/jenkins-linux/762  

2020年12月07日 0Comments 933Browse 0Like Read more
Computer Science

Jenkins 的 CentOS 8 安装目录和路径

Jenkins 的文件结构目录如下。 在 CentOS 8 的操作系统下,具体的路径是在 /var/lib 目录下的。 所有的配置文件都在这里,包括有你 Job,这是你的任务目录。 JENKINS_HOME +- config.xml (jenkins root configuration) +- *.xml (other site-wide configuration files) +- userContent (files in this directory will be served under your http://server/userContent/) +- fingerprints (stores fingerprint records) +- nodes (slave configurations) +- plugins (stores plugins) +- secrets (secretes needed when migrating credentials to other servers) +- workspace (working directory for the version control system) +- [JOBNAME] (sub directory for each job) +- jobs +- [JOBNAME] (sub directory for each job) +- config.xml (job configuration file) +- latest (symbolic link to the last successful build) +- builds +- [BUILD_ID] (for each build) +- build.xml (build result summary) +- log (log file) +- changelog.xml (change log) 具体的官方文档参考地址为:https://wiki.jenkins.io/display/JENKINS/Administering+Jenkins https://www.ossez.com/t/jenkins-centos-8/757

2020年12月07日 0Comments 907Browse 0Like Read more
Computer Science

Jenkins 编译的时候提示错误 JAVA_HOME environment

在使用 Jenkins 进行编译的时候提示错误: The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE 解决办法 在 Jenkins 中选择 Manage Jenkins,然后选择 配置系统.     配置系统     然后选择全局属性后,添加一个变量为 JAVA_HOME 就可以解决这个问题了。     然后再重新编译后就可以解决参数配置问题。 https://www.ossez.com/t/jenkins-java-home-environment/761

2020年12月07日 0Comments 737Browse 0Like Read more
Computer Science

Jenkins CentOS 8 设置默认端口

Jenkins 使用的默认端口是 8080。 在 CentOS 你可以通过修改 /etc/sysconfig/jenkins 文件中的 JENKINS_PORT=“8080” 端口来修改 Jenkins 使用默认的端口。     当你重新启动后,就可以使用新的端口了。 https://www.ossez.com/t/jenkins-centos-8/758

2020年12月07日 0Comments 654Browse 0Like Read more
Computer Science

Java 如何获得文件的 Media Type

一般来说你可以使用 Apache Tika 来获得文件的类型。 Tika 是一个内容分析工具 Maven 设置 maven 的版本到你的 POM 文件中。 <!-- https://mvnrepository.com/artifact/org.apache.tika/tika-core --> <dependency> <groupId>org.apache.tika</groupId> <artifactId>tika-core</artifactId> <version>1.25</version> </dependency> 测试代码 例如,我们可以使用下面的测试代码。 @Test public void whenUsingTika_thenSuccess() { File file = new File("product.png"); Tika tika = new Tika(); String mimeType = tika.detect(file); assertEquals(mimeType, "image/png"); } 你需要首先 New 一个文件对象,然后通过文件对象进行测试就可以了。 例如我们使用上面类似的代码测试了一些代码: 09:32:36.377 [main] DEBUG c.i.s.c.test.utilities.FileUtilsTest - TXT - [text/plain] 09:32:36.389 [main] DEBUG c.i.s.c.test.utilities.FileUtilsTest - CSV - [text/csv] 09:32:36.395 [main] DEBUG c.i.s.c.test.utilities.FileUtilsTest - XLS - [application/vnd.ms-excel] 09:32:36.399 [main] DEBUG c.i.s.c.test.utilities.FileUtilsTest - XLSX - [application/vnd.openxmlformats-officedocument.spreadsheetml.sheet] 上面测试过一些文件类和类型的返回。 https://www.ossez.com/t/java-media-type/753

2020年12月05日 0Comments 612Browse 0Like Read more
Computer Science

Apache POI Strict OOXML isn’t currently 错误

在处理文件的时候 POI 提示错误: org.apache.poi.ooxml.POIXMLException: Strict OOXML isn't currently supported, please see bug #57699 at org.apache.poi.ooxml.POIXMLDocumentPart.getPartFromOPCPackage(POIXMLDocumentPart.java:779) at org.apache.poi.ooxml.POIXMLDocumentPart.<init>(POIXMLDocumentPart.java:175) at org.apache.poi.ooxml.POIXMLDocumentPart.<init>(POIXMLDocumentPart.java:165) at org.apache.poi.ooxml.POIXMLDocument.<init>(POIXMLDocument.java:61) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:282) 这是因为你的 Excel 保存的格式版本为 Strict Open XML 格式。 你需要将这个文件保存为 Excel WorkBook 格式才能够被 POI 读取。     针对这个问题暂时没有太多的解决办法,你只能让用户保存为 Excel WorkBook 格式才能让 Apache POI 处理。 https://www.ossez.com/t/apache-poi-strict-ooxml-isnt-currently/752

2020年12月05日 0Comments 594Browse 0Like Read more
1…117118119120121…237
Archives
  • June 2026
  • May 2026
  • April 2026
  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
Categories
  • Computer Science (2,367)
    • Confluence (663)
    • Gradle (12)
  • U.S. (516)
  • 文化旅游 (146)

COPYRIGHT © 2020 CWIKIUS. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS

湘ICP备2020018253号-1