• PHP handles floating point precision operations, digital processing, etc


    preface 1. When PHP floating-point numbers are calculated, slight carelessness will lead to deviation, especially in financial industry, E-Commerce orders and mall projects. 2. The precision of floating point number is limited. Although depending on the system, PHP usually uses IEEE 754 double precision format, the maximum relative error due to rounding is 1.11e-16. Non […]

  • Sharding JDBC integrates mybatis plus to realize the solution of sub database and sub table


    Project address: Github Gitee Official documents: Sharding-JDBC Mybatis-Plus 1、 Run test Step 1: create two new databases:seal_sharding、seal_sharding1 Step 2: import SQL files in DB directory respectively Step 3: open the project and configure environment variablesMYSQL_HOST、MYSQL_PORTAnd user name and password Step 4: run test files (under test package) 2、 Acquisition of tenant ID Modify mybaitsplusconfig.java under […]

  • Cut the rope


    The ingenious way to solve the problem lies in the deep understanding of the essence of the problem problem There is such a programming problem in Jianzhi offerHere is a rope of length n. please cut the rope into m segments of integer length (M and N are all integers, n > 1 and M […]

  • Canvas 2D non zero sum and parity wrapping rules


    The left is odd and even, and the right is non-zero Environmental Science 2D graphics different systems, different browsers may use different graphics library. chromeUsingskiaGraphic function library firefoxUsingcairoGraphic function library skiaAndcairoIt encapsulates the back end, so it can cross platformchromeThe graphics library used isskiaHowever, the underlying graphics library may be different on different systems, such […]

  • Reference the API in kernel32.dll for serial communication


    Serial port communication can export the API in kernel32.dll to operate. The relevant source code is as follows:using System;using System.Runtime.InteropServices; namespace Telehome.GSM{/// /// ************************************************************************************/// ///Function: connect and disconnect the serial port; send and receive the serial port data, and use the related serial port operations in kernel32.dll///Function to operate COM port/// /// Author: Telehome.Hzyong /// /// DateTime: 2005-11-20/// /// ************************************************************************************/// […]

  • Sort arrays by parity


    export default (arr) => { //Sort ascending arr.sort((a, b) => a – b) //Declare an empty array to store the array after parity sorting let r = [] //Record odd and even Subscripts let odd = 1 let even = 0 //Traversing an array arr.forEach(item => { if (item % 2 === 1) { r[odd] […]