Tag:shortcoming

  • [thinking] redis’s key deletion strategy and memory elimination mechanism

    Time:2021-10-19

    1. Expiration policy of redis 1. Scheduled deletion While setting the expiration time of a key, create a timer for the key to delete the key when the expiration time of the key comesadvantage:Ensure that the memory is released as soon as possibleDisadvantages:1) If there are many expired keys, deleting these keys will take a […]

  • Several ways of connecting strings in Java and their advantages and disadvantages

    Time:2021-10-7

    Several ways of connecting strings in Java and their advantages and disadvantages String concatenation is very common in Java programs. This article will summarize four ways of string concatenation +connect String.concat() StringBuilder StringBuffer use+Number connection class Helloworld { result: Hello World! advantage: Simple operation Disadvantages: Because each use will generate a new string object to […]

  • Question 49: how to implement an object deep copy?

    Time:2021-9-21

    Suppose we want to copy an object. If we don’t make a deep copy of it, after changing one object, the other object will also change Normal scenario let a = { age: 20 }; let b = a; b.age = 30; console.log(a.age); // 30 This is not the effect we want, so when we […]

  • Maven project introduces local jar package method

    Time:2021-9-13

    If you need to introduce third party packages, such as express birds, Alipay, WeChat and other jar packages (of course, it is possible to directly provide Maven dependence). If you download it locally, how can you integrate it into your Maven project? There are many ways. Here are four ways 1. Upload to Maven central […]

  • How does webpack output both compressed and uncompressed files

    Time:2021-8-30

    Sometimes we want to generate compressed and uncompressed files at the same time. For example, when we build the Lib package, we want users to use the compressed code file as the CDN file. The simplest way is to specify environment variables, such as minify, as follows: const path = require(‘path’) const isMinify = process.env.MINIFY […]

  • How to await an asynchronous method in emit code

    Time:2021-6-23

    0. Preface First of all, explain immediately why there is such a fake title of demo essay?It’s not that I have knowledge mistakes, or that I want to mislead my childrenBecause we all know that all the methods written by emit are synchronization methods, and it is impossible to await. At least for so many […]

  • JS format number 1234567890 — > 1234567890

    Time:2021-6-1

    Number format 1234567890 — > 1234567890 1. Ordinary version function formatNumber(str) { let arr = [], count = str.length while (count >= 3) { arr.unshift(str.slice(count – 3, count)) count -= 3 } //If it’s not a multiple of 3, add it to it str.length % 3 && arr.unshift(str.slice(0, str.length % 3)) return arr.toString() } console.log(formatNumber(“1234567890”)) […]

  • Ideas sharing: how to try to create your own CSS framework?

    Time:2021-4-16

    In 2019, I created a CSS framework and named itRotala.css. After some refactoring and modification, I finally released the “toy” framework in 2020. But it’s still in prototyping because I don’t think my solution is elegant. in limine The reason I built this framework is simple: I want a CSS framework myself. I know it […]

  • Linux software installation method

    Time:2021-4-2

    1、yum/rpm(*.rpm) Package manager: direct Yum / RPM installation. Advantages: full automatic installation, no need to worry about dependency problems, disadvantages are poor autonomy, software function, storage location is fixed, not easy to change. 2. Source code package * tar.gz ) There are some disadvantages in compile install. / configure; make; make install: you can customize […]

  • Java set topology

    Time:2021-3-23

    Java collectionList, set, queue and map interfaces.There are mainly the following implementation classes. List->Vector->Stack(c) ->ArrayList(c) ->LinkedList(c) Set->HashSet->LinkedHashSet(c) ->TreeSet(c) ->EnumSet(c) Queue->Deque->ArrayDeque(c) ->LinkedList(c) ->PriorityQueue(c) Map->HashMap(c)->LinkedHashMap(c) ->TreeMap(c) ->HashTable(c) ->Identityhashmap (C, stores the reference, the equal sign determines whether the key exists, null is not allowed) ->ConcurrentHashMap(c) Thread safe: vector, stack, hashtable, others are not thread safe. In addition, […]

  • The front end uses node to crawl data

    Time:2021-2-9

    Crawler needs, basically in each company will have, will inevitably fall on the head of front-end development. Today, let’s see how node crawls data. In fact, for the front-end to grab data, AJAX requests an interface, but the return value has a valuetext/html(early XML and the like),application/jsonThere are two kinds. Sometimes for some simple data […]

  • Implementation of extremely thin border (1px border)

    Time:2021-1-25

    Mobile terminalwebProblems encountered in development: the UI draft requires setting the border to1px, CSS settingsborder: 1px solid #eee;After that, the UI said the border was too thick. that is becausedevicePixelRatioThis is caused by the characteristics. CSS settings1pxyesCSS pixelAnd the UI draft refers toDevice pixelThere is a proportional relationship between them,devicePixelRatio. IPhonedevicePixelRatio == 2, andborder-width: 1pxIt […]