• Strategy code examples of PHP design patterns (30)


    objective Separate “strategies” and enable them to quickly switch to each other. In addition, this pattern is a good alternative to inheritance (instead of extending abstract classes). example Simplified version of unit testing: switching between using file storage and memory storage, for example Sort a list of objects, one by date and one by ID […]

  • Vbs script for searching and replacing batch files


    ‘============================================ ‘code by LCX modify a small program on the Internet. I don’t know the author. The program doesn’t implement recursive search on the directory‘put this program in the directory you want to look for, or drag the directory to this script. It is estimated that there are still bugs‘======================================================================================= On Error Resume next Do Until False Findstr = InputBox […]

  • Kapt’s going out? Annotation processing new pose KSP coming


    I saw this thing when I was visiting developers recently Curiosity: kotlin symbol processing API What is this? Kotlin Symbol Processing (KSP) is an API that you can use to develop lightweight compiler plugins. KSP provides a simplified compiler plugin API that leverages the power of Kotlin while keeping the learning curve at a minimum. […]

  • Spring MVC cannot access the root directory


    Spring 3 was used at the beginning. When it was deployed to tomcat7, it was found that the root directory could not be accessed It is found that Tomcat6 can be accessed. It may be that a servlet version and Tomcat compatible bug have been triggered Finally, we know that it is the problem of […]

  • The usage of replace function in JS regular expression


    Regular expression replace() function:This function replaces the substring in the string that matches the regular expression with the specified string.The return value is a new string after replacement.This article only introduces the regular expression related operations. For other replacement operations, please refer to the article “replace() method of JavaScript string object”.Grammatical structure: stringObject.replace(regexp,replacement) The parameter […]

  • Hypothesis test: use the p value to accept or reject your hypothesis


    AuthorCompile | VKSource | analytics vidhya introduce Test is one of the most basic concepts in statistics. Not only in data science, hypothesis testing is very important in various fields. Want to know how to do it? Let’s take an example. Now there’s a lifebuoy shower gel. Shower Gel manufacturers claim it kills 99.9% of […]

  • Four PHP techniques to improve script performance


    Usually, I write code using plain regular PHP functions to solve the problem. But for some of these problems, I came across alternative solutions that specifically improved performance. In this article, I’d like to introduce some alternatives. This is useful if you are looking for possibilities to reduce execution time in production. Let’s see which […]

  • How to realize extensibility of program


    Refer to the extensibility provided in ABP Keep updating Implementation 1: Define an interface public interface IMessageWriter { string Write(); } Define an implementation that is to be replaced by another implementation class: public class ConsoleMessageWriter : IMessageWriter, ITransientDependency { public string Write() { return “ConsoleMessageWriter.Write”; } } Alternative implementation class: [dependency (replaceservices = true)] […]

  • How to install python2 on Ubuntu 20.04


    Python 2 has been removed from Ubuntu 20.04, but if you need legacy programs from old python, you can still install and configure them. Step 1: install Python 2SSH to your Ubuntu 20.04 server and install Python 2 using apt. $ sudo apt install python2 Check the python version. $ python2 -V Python 2.7.17 Step […]

  • To solve the problem of invalid replacement of Python replace function


    Invalid replacement of Python replace function str = “hello,china!” str.replace(“hell”,”well”) print(str) hello,China! Process has ended, push code 0 When writing the code, we found that the replacement did not succeed. reason: In Python, strings are immutable objects. So the string needs to be reassigned to generate a new object by using replace. There is no […]

  • Error type mismatch problem using Flink processwindowfunction


    1. Error code val window = .keyBy(0) .timeWindow( Time.seconds (5) ) // in short, whether to call tumbling processingtimewindows or tumbling eventtimewindows depends on the time characteristics of the configuration? .process(new MyProcessWindowFunction) class MyProcessWindowFunction extends ProcessWindowFunction[(Int,DenseVector),DenseVector,Int,TimeWindow] { override def process(key: Int, context: Context, elements: Iterable[(Int, DenseVector)], out: Collector[DenseVector]): Unit = { val points: Iterable[DenseVector] = […]

  • JS and replace use regular expressions to replace all SQL parameters in the specified format


    SQL parameter format, for example: select * from TB where nd =: Nd and YD =: YDYou want to change all the parameters (with colons) in all SQL statements into data at one time, startSelect regular expression. It was originally written like this Copy codeThe code is as follows: strsql.replace(/(:\w+)/g,(“$1”).substring(1)); “$1” always resolves to a […]