Tag:Situation

  • General cache update strategy

    Time:2021-1-26

    We generally summarize cache update strategies as follows FIFO [First In First Out] The data that first enters the cache will be cleaned out when the cache space is insufficient LFU [Less Frequently Used] The least used cache will be cleaned up, which requires that the cached elements have hit attribute. In the case of […]

  • The problem of planting flowers

    Time:2021-1-21

    Suppose you have a very long flowerbed, with some plots planted with flowers and some plots not. However, flowers can not be planted on adjacent plots, they will compete for water, and both will die. Given a flower bed (represented by an array containing 0 and 1, where 0 means no flowers are planted and […]

  • Leetcode interview question 16.11. Implementation of diving board in Python

    Time:2021-1-14

    Title Requirements: Thinking: There are three situations In the first case, k = 0, that is to say, you need to use 0 boards and return the empty array directly In the second case, long is the same as short, then only the unique solution isshorter * k In the third case, shorter is not […]

  • Promise three states

    Time:2021-1-13

    Three states 1. Pending: there is no result in the process2. Resolved: success3. Rejected: failed State change 1、pending -> resolved2、pending -> rejected Performance of state The pending state does not trigger then and catchThe resolved state triggers subsequent then callbacksThe rejected state triggers subsequent catch callbacks Then and catch change state Under normal circumstances, resolved […]

  • Leetcode 16.11. Diving board | Python

    Time:2021-1-13

    Diving board Title Source: leetcode https://leetcode-cn.com/problems/diving-board-lcci subject You’re building a diving board out of a pile of boards. There are two types of boards, of which the shorter one isshorterThe length of the longer board islonger。 You have to use it exactlykA board. Write a method to generate all possible lengths of the diving board. […]

  • Pyspider all will encounter many obstacles! (Python3.7)

    Time:2021-1-9

    Case 1: ValueError: Invalid configuration: – Deprecated option ‘domaincontroller’: use ‘http_authenticator After installing pyspider successfully, the above problems will occur after running pyspider all; terms of settlement: In the installation package of pyspider, find the webui folder, and then find the webdav.py File, find the following code:’domaincontroller’: NeedAuthController(app), It is amended as follows: ‘http_authenticator’:{ ‘HTTPAuthenticator’:NeedAuthController(app), […]

  • Realization of monitoring index in libp2p RS

    Time:2021-1-5

    Module address:https://github.com/netwarps/l… Libp2p RS as a P2P network project, sometimes we may need to observe the sending and receiving of network data, and collect and summarize it. Based on this premise, a metric module is designed to implement the related content. Conception of metric implementation Libp2p supports connecting multiple peers, and each peer supports different […]

  • Mapping of data structure

    Time:2021-1-4

    mapping Mapping with linked list Create map interface and implementation class. public interface Map<K, V> { void add(K key, V value); V remove(K key); boolean contains(K key); V get(K key); void set(K key, V value); int getSize(); boolean isEmpty(); } public class LinkedListMap<K, V> implements Map<K, V> { private class Node { public K key; […]

  • Kubernetes service stops gracefully

    Time:2021-1-4

    Graceful shutdown Graceful shutdown: finish the resource cleaning before stopping the program. For example: Operation data: cleaning and transferring data. When the database node restarts, it needs to be considered Anti registration: inform the gateway or service registry before the program exits, and stop the service after the service is offline. At this time, no […]

  • Time synchronization of the system

    Time:2021-1-1

    Make sure the time is correct and synchronized before generating the key Immediate synchronization: ntpdate 172.18.0.1 synchronizes with the server and takes effect immediately When this error occurs, the NTP socket is in use, exiting Do this: service ntpd stop Always in sync with server mode: Modify the configuration file:centos6 vim /etc/ ntp.conf (profile) Server […]

  • SQL script exercises with SAP Hana web based development tool

    Time:2020-12-29

    The contents of the database table provided by the CSV file are as follows: links.csv Format: movies.csv Format: a movie can have multiple genres, separated by | ratings.csv: Users score movies: tags.csv : movie tag Exercise 1: List the total number of records in the four tables: select ‘links’ as “table name”, count(1) as “row […]

  • Performance analysis of azure SQL database

    Time:2020-12-25

    Preconditions Users have the right to query data statistics GRANT VIEW DATABASE STATE TO database_user; CPU performance issues in progress View the top x CPU consumption queries (summary) SELECT TOP 10 GETDATE() runtime, * FROM ( SELECT query_stats.query_hash, SUM (query_stats.cpu_time) ‘Total_Request_Cpu_Time_Ms’, SUM (logical_reads) ‘Total_Request_Logical_Reads’, MIN (start_time) ‘Earliest_Request_start_Time’, COUNT (*) ‘Number_Of_Requests’, SUBSTRING (REPLACE(REPLACE(MIN (query_stats.statement_text),CHAR (10),’ ‘),CHAR […]