Something

首页 / 文章 / RSS

文章

[2024-04-09] 不同编程语言实现方式:时间戳(Timestamp)

时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数,不考虑闰秒(Leap Seconds)。

时间戳的主要目的在于通过一定的技术手段,对数据产生的时间进行认证,从而验证这段数据在产生后是否经过篡改。所以时间戳服务的提供者必须证明服务中使用的时间源是可信的,所提供的时间戳服务是安全的。

[2024-01-17] Linux中如何实现大文件分卷压缩和合并解压

个别时候,当我们想上传文件时,可能因为文件太大,网速太慢等原因,导致上传失败。此时,我们必须将大文件分割成一些小文件,以便上传。

本文将介绍在Linux中,如何通过以下几种方法实现大文件的分卷压缩和合并解压:

方法一:tar

方法二:zip

方法三:7z

[2024-01-11] Linux下如何修改路由表优先级

在多个网络连接的情况下,比如WIFI和VPN同时存在的时候,路由表中就会存在多个默认网关。

个别情况下,您也许需要修改路由优先级,比如,在使用 UxPlay 将iOS设备投屏到Linux时,如果VPN路由优先级高,则会导致投屏失败,此时,需要将WIFI路由优先级调高即可解决投屏失败问题。

本文将介绍如何查看和修改路由优先级。

[2024-01-02] Linux区域设置(locale)

区域设置是一组环境变量,用于定义Linux系统上应用程序和shell会话的语言、国家/地区和字符编码设置(或任何其他特殊变体首选项)。

区域设置会影响时间/日期格式、一周的第一天、数字、货币和许多其他根据您在Linux系统上设置的语言或地区/国家格式化的值。

在本文中,我们将展示如何查看当前安装的系统区域设置,以及如何在Linux中设置系统的区域设置。

[2023-12-15] 如何清除GitHub提交历史记录

GitHub是开发人员和团队管理、协作和跟踪工作的重要工具。但是,有时您可能需要删除提交历史记录,以清理存储库或删除敏感信息。

本文将介绍如何使用Git命令从GitHub删除提交历史记录。

[2023-12-15] 如何清理Linux系统日志

systemd-journal是Linux的日志系统。它收集和存储内核日志数据、系统日志消息、标准输出和各种系统服务的错误。

systemd-journal仅仅把日志集中保存在单一结构的日志文件/var/log 中,由于日志是经历过压缩和格式化的二进制数据,所以在查看和定位的时候很迅速。

日志记录的问题是,随着时间的推移,它开始变得越来越大。如果你检查Linux中的磁盘空间,你会发现有时它需要几个GB的空间。

本文将介绍如何清理systemd日志,释放Linux系统上的磁盘空间。

[2023-12-06] SpringBoot处理CORS跨域请求

In any modern browser, Cross-Origin Resource Sharing (CORS) is a relevant specification with the emergence of HTML5 and JS clients that consume data via REST APIs.

Often, the host that serves the JS (e.g. example.com) is different from the host that serves the data (e.g. api.example.com). In such a case, CORS enables cross-domain communication.

Spring provides first-class support for CORS, offering an easy and powerful way of configuring it in any Spring or Spring Boot web application.

[2023-11-30] 查看Java .class文件版本号

本文将介绍如何查看.class文件和jar文件的Java发行版本。

[2023-11-27] 如何在Linux Shell中获取本周的第一天和最后一天

在Shell编程中,可以使用 date 命令获取本周的第一天和最后一天。

[2023-11-23] How to Mock Environment Variables in Unit Tests

When we’re unit testing code that depends on environment variables, we may wish to provide specific values for them as part of our test implementation.

Java doesn’t allow us to edit the environment variables, but there are workarounds we can use, and some libraries which can help us.

In this tutorial we’ll look at the challenges of depending on environment variables in unit tests, how Java has made this even harder in recent versions, and the JUnit Pioneer, System Stubs, System Lambda and System Rules libraries. We’ll look at this for JUnit 4, JUnit 5 and TestNG.

[2023-11-20] Executable Comments in Java

Comments can be useful when we need additional notes in our code. They can help us make our code more understandable. Additionally, they can be especially useful in methods that perform complex operations.

In this tutorial, we’ll explore cases where comments in our code can become executable. Or at least it may appear like they can.

[2023-11-13] Java反射:判断方法是Getter还是Setter

在使用反射(Reflection)过程中,常常需要获取Class的Getter或Setter,以下代码可以用来检查Method,是Getter还是Setter。

[2023-11-10] ASCII Code - The extended ASCII table

ASCII, stands for American Standard Code for Information Interchange. It's a 7-bit character code where every single bit represents a unique character. On this webpage you will find 8 bits, 256 characters, ASCII table according to Windows-1252 (code page 1252) which is a superset of ISO 8859-1 in terms of printable characters. In the range 128 to 159 (hex 80 to 9F), ISO/IEC 8859-1 has invisible control characters, while Windows-1252 has writable characters. Windows-1252 is probably the most-used 8-bit character encoding in the world.

[2023-11-10] 如何移除MySQL字段中的Html标签

在处理文本数据时,我们经常会遇到需要清除HTML标签的情况,在MySQL中,我们可以使用正则表达式和一些字符串函数来实现这一目标。 本文将介绍如何使用MySQL清除HTML标签。

[2023-11-10] 如何禁用F12浏览器开发者工具

当不想让自己的前端代码被用户调试时,需要使用户无法打开或使用浏览器的开发者工具。

使用如下JS脚本后,用户打开浏览器开发者工具时,将无限debugger,从而实现禁用效果。

attachments

[2024-04-09] 不同编程语言实现方式:时间戳(Timestamp)

时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数,不考虑闰秒(Leap Seconds)。

时间戳的主要目的在于通过一定的技术手段,对数据产生的时间进行认证,从而验证这段数据在产生后是否经过篡改。所以时间戳服务的提供者必须证明服务中使用的时间源是可信的,所提供的时间戳服务是安全的。