• Leetcode 204


    Title Requirements thinking Create an array mylist, the length of which is n, and initialize all elements of the array to true Create another array res to hold prime numbers The 0 subscript position of the array is assigned to FALS, indicating that 1 is not a prime number Traverse the array subscript 1 ~ […]

  • [title] card grouping – lotcode


    Title: card grouping Given a deck of cards, an integer is written on each card. At this point, you need to select a number x, so that we can divide the whole deck into one or more groups according to the following rules: Each group has X cards.All cards in the group have the same […]

  • Solution to multiple primary key defined error in MySQL


    There are two ways to create a primary key: Create table name( Field name type, Field name type, …… primary key(name) ); Or is it Create table name( Field name type primary key, Field name type, …… ); But note that if you want to create a composite primary key, you can’t use the second […]

  • Chapter 5: divisibility and the greatest common factor (1)


    Suppose m and N are integers,m\neq 0。 If n is a multiple of M, there exists an integer k such thatn= mk。 If M is divisible by N, we write it asm|n; ifmDo not dividen, we remember asm\nmid n。 For example, because6=3·2, so3|6。6The factor of is1,2,3。 Because there is no5A multiple of is equal to7, […]

  • Chapter 6: linear equations and the greatest common factor (2)


    Now, we know the equation ax+by=gcd(a,b) There is always an integer solutionxAndyHow many solutions are there and how to express them?We are mutually exclusiveaAndbLet gogcd(a,b)=1, assuming(x_1,y_1)It’s an equationax+by=1A solution of. adoptx_1subtractbSum of multiples ofy_1addaOther solutions can be obtained. In other words, for any integerkWe get a new solution(x_1+kb,y_1-ka)By calculating a(x_1+kb)+b(y_1-ka)=ax_1+akb+by_1-bka=ax_1+by_1=1 Still observinggcd(a,b)=1It can be proved […]

  • Retry mechanism


    There are two mechanisms for retrying: guava and spring. Guava retryer tool POM reference <dependency> <groupId>com.github.rholder</groupId> <artifactId>guava-retrying</artifactId> <version>2.0.0</version> </dependency> test method Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder() .retryIfExceptionOfType(Exception.class) //If you return false, you also need to try again .retryIfResult(Predicates.equalTo(false)) //Reorientation strategy .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS)) //Number of attempts .withStopStrategy(StopStrategies.stopAfterAttempt(3)) .build(); try { //Executes the specified method. retryer.call(() -> { […]

  • Vue + gaude map to realize track playback and play progress bar / multiple / time


    Demand:1: Track playback: play, pause, resume2: Progress bar, track playback, progress bar should also play, track stop playing, progress bar should be suspended.3: Multiple: not playing selection multiple, playing selection multiple, pause selection multiple.4: Play time In the Gaode API example, only the simplest play, pause and continue to play is required.Therefore, it is necessary […]

  • (44) C × WinForm custom control – water wave – hzhcontrols


    Official website http://www.hzhcontrols.com premise It’s been 7 or 8 years since I started, I always want to make a set of beautiful custom controls, so I have this series of articles. GitHub:https://github.com/kwwwvagaa/NetWinformControl Code cloud: https://gitee.com/kwwwvagaa/net_ winform_ custom_ control.git If you think it’s OK, please click star to support it Welcome to discuss: Penguins 568015492 Please […]

  • Getting started with quartz (2) simpletrigger


    Trigger means trigger, which is used to specify when to trigger, how many times to trigger, and how often to triggerSimple trigger can easily implement a series of trigger mechanisms. 1. The next multiple of 8 seconds starts to run: public class SimpleTriggerDemo { public static void main(String[] args) throws Exception{ Scheduler scheduler= StdSchedulerFactory.getDefaultScheduler(); Date […]

  • Regular expression judgment date


    Project background Check whether the date of the latest project is normal Solution Using regular expression validation Check 0000-9999 universal 01 and 1 – and / leap years^(([0-9]{3}[1-9]|[0-9]{2}1-9{1}|[0-9]{1}1-9{2}|1-9{3})(-|/)(((0[13578]|1[02]|[13578])(-|/)(0[1-9]{1}$|[12][0-9]$|3[01]$|[1-9]{1}$))|((0[469]|11|[469])(-|/)(0[1-9]$|[12][0-9]$|30$|[1-9]$))|((02|2)(-|/)(0[1-9]|1|2[0-8]|[1-9]))))$|^((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[13579][26])00))(-|/)(02|2)(-|/)29)$ Remarks Leap year is a noun in the Gregorian calendar. Leap years are divided into ordinary leap years and century leap years.Common leap year: the Gregorian calendar […]

  • Retry retry mechanism


    There are two retry mechanisms: guava and spring. Guava retryer tool POM reference <dependency> <groupId>com.github.rholder</groupId> <artifactId>guava-retrying</artifactId> <version>2.0.0</version> </dependency> test method Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder() .retryIfExceptionOfType(Exception.class) //Return false also need to retry .retryIfResult(Predicates.equalTo(false)) //Readjustment strategy .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS)) //Number of attempts .withStopStrategy(StopStrategies.stopAfterAttempt(3)) .build(); try { //Executes the specified method. retryer.call(() -> { System.err.println(“do something…”); Throw new exception […]

  • Judging whether a number is prime


    I. Concept Introduction   Primes are also called prime numbers. A natural number greater than 1 (starting from 2), except for 1 and itself, can not be divided by other natural integers is called prime number, otherwise it is called composite number. 0 and 1 are neither prime nor composite, and the smallest prime is 2. […]