Author Archives: Robins

Invalid host header error in Vue using peanut shell agent

In the root directory of the project of the package. The json file “dev” : “webpack dev – server – the content – base./- open – the inline – hot — compress – history – API – fallback – config build/webpack dev. Config. Js” add – behind the host 192.168.1.5 (fill in your own IP address). This is because the new version of webpack-dev-server checks the hostname by default for security reasons, and breaks access if the hostname is not in the configuration. You can add the following webpack-dev-server configuration to webpack.base.config.js in the build directory: devServer: {disableHostCheck: true,},

How to handle when select single is not allowed in loop

What happens when select single is not allowed in the LOOP
Examples: Materials are available at a variety of prices and have expiry dates

    this part of the first I contact processing, was conducted in DSO itself in a transformation:
    first result_package according to the actual delivery date to heavy, and then for the first and the last one, make sure the date range of package
    based on the above date range to need to get the data in the table
    then LOOP itself, try to reduce data after
    LOOP itself, split the date range a a

    This approach requires setting up semantic groups
    Note: this article is my daily record of learning, do not carry out any commercial so do not support reprint please understand

When react dynamically prunes components by operating arrays, the state of the remaining components is not preserved. Solution to the problem (method of dynamically setting unique key value)

Problem: There is A public component A whose parent component B renders A by iterating through the array. Dynamic addition or deletion of an array is the same as dynamic addition or deletion of component A. The problem is that the user is responsible for adding and deleting, so there is no way to give a fixed key at the beginning. In the beginning, index is used as the key value, but adding or deleting components will refresh the key value of previous components, resulting in the state cannot be preserved.
solution:
br> a>

>

Python uses the priority queue to get the maximum k elements

Use PriorityQueue to get the maximum K elements
In order to sort slightly larger numbers, sometimes you don’t want all of the data, you just want the maximum k numbers up front, if you use sorted numbers ([…]). )[::-1][:k] Implementation efficiency is much lower. In order to optimize the execution speed, PriorityQueue can be used to achieve the maximum k elements. At the same time, the space can also be significantly optimized

import queue
import random

K = 12
q = queue.PriorityQueue()
tlist = []

for ith in range(100):
    q.put((ith, ith + random.randrange(100)))
    if q.qsize() > K: q.get() # pop least item
        
while not q.empty():
    tnum = q.get()
    tlist.append(tnum)

tlist.sort(reverse=True)
print(tlist)

The effect

[(99, 187), (98, 152), (97, 184), (96, 136), 
(95, 105), (94, 119), (93, 109), (92, 169), 
(91, 149), (90, 143), (89, 91), (88, 92)]

Priorityqueue are in queue bag and priorityqueue implementation in the queue is called headq inside the top of the heap, so did not provide key parameters change priority queue sorting rules, only from small to large, ascending order so, in order to get top K elements, need to queue size is greater than K pop team first element, maintain the biggest K in queue, and then use a list to undertake the element in the queue, and then descending sort results for the target at a time.

Mybatis error “field ‘ID’ doesn’t have a default value”

SelectKey = SelectKey; SelectKey = SelectKey; SelectKey = SelectKey; SelectKey = SelectKey; SelectKey = SelectKey; SelectKey = SelectKey; SelectKey = SelectKey

   @Insert({"insert into song(name,singer,category,writer,language,issudate)values(#{name},#{singer},#{category},#{writer},#{language},#{issudate})"
    })
    @SelectKey(statement = "select last_insert_id()",before = false, resultType = Integer.class,keyProperty = "id")
    public int insert(Songs songs);
}

package.json And package- clock.json The difference between

Json versus package.json
Json is the configuration file generated when building a project, which contains the configuration information needed for the project, as well as various dependencies, including name and version number; It is divided into development dependencies and operation dependencies. ^ Refers to other updated versions after the current major version

{
  "name": "managenmet",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^2.6.11"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

Json is the latest version dependency automatically generated after NPM installIt is used to record the version number of the current project dependency and cannot be changed. When you delete node_modules or modify package.json and execute NPM install, the current project dependencies will be updated to the appropriate version according to the rules

MinGW + libpython installation record

> Error conda.core.link:_execute_actions(337): An ERROR occurred while installing package ‘;
> Error conda.core.link:_execute_actions(337): An ERROR occurred while installing package ‘; ERROR conda.core.link:_execute_actions(337): An ERROR occurred while the package was installed;


Type in the following code in CMD:

conda install mingw libpython

The following error occurred:

The following NEW packages will be INSTALLED:

    conda-package-handling: 1.7.2-py36h76e460a_0
    libpython:              2.1-py36_0
    mingw:                  4.7-1
    tqdm:                   4.55.1-pyhd3eb1b0_0

The following packages will be UPDATED:

    conda:                  4.3.30-py36h7e176b0_0 --> 4.9.2-py36haa95532_0
    conda-env:              2.6.0-h36134e3_1      --> 2.6.0-1
    menuinst:               1.4.10-py36h42196fb_0 --> 1.4.16-py36he774522_1
    pycosat:                0.6.2-py36hf17546d_1  --> 0.6.3-py36h2bbff1b_0
    vc:                     14-h2379b0c_2         --> 14.2-h21ff451_1
    vs2015_runtime:         14.0.25123-hd4c4e62_2 --> 14.27.29016-h5e58377_2

Proceed ([y]/n)?y

libpython-2.1- 100% |###############################| Time: 0:00:37   1.08 MB/s
ERROR conda.core.link:_execute_actions(337): An error occurred while installing package 'defaults::tqdm-4.55.1-pyhd3eb1b0_0'.
CondaError: Cannot link a source that does not exist. D:\software\Anaconda\Scripts\conda.exe
Running `conda clean --packages` may resolve your problem.
Attempting to roll back.

Solutions:

conda clean --all

Type in the following code again:

conda install mingw libpython

Installation successful!

On the intern () method of string class in Java

String s1 = new StringBuilder(” Go “).append(” od “).toString();
System.out.println(s1.intern() == s1); String s2 = new
StringBuilder(” ja “).append(” va “).toString(); String s2 = new
StringBuilder(” ja “).append(” va “).toString();
System.out.println(s2.intern() == s2); Output is true or false
in the search on the net, have explained string constants in the pool a Java this string constants, and so the example below would be false.

String sb =new StringBuilder(” Go “).append(” OD “).toString();
String sb =new StringBuilder(” Go “).append(” OD “).toString();
String s1 = new String(” Good “);
System.out.println(sb.intern()==sb);
returns false!!
originally used in intern method, will first judgment in the constant pool have the corresponding string, have put the string, not words

The intern() implementation in JDK 1.7 does not copy the instance any more, it just records the instance reference that first appears in the constant pool, so the reference returned by the intern() is the same as the instance of the string created by the StringBuilder

Access characteristics of construction methods in Java inheritance

Access characteristics of constructors in Java inheritance
The

    subclass constructor has a default implicit “super()” call, so it must be the parent constructor called first and the subclass constructor executed later. Subclass constructs can be invoked with the super keyword to call superclass overloaded constructs. Super’s superclass constructor call must be the first statement of the subclass constructor. A subclass construct cannot call the super construct more than once.

Conclusion:
subclasses must call the superclass constructor, don’t write gives super (); You can only have one super, and it has to be the first one.

V-for styles individual elements

v-forts styles for individual elements
v-formponent can loop through a bunch of components. However, when styling, there is a need for individual elements to be styled in such a way that they are highlighted.

<card-grid
        style="width:25%; text-align: center"
        v-for="(item,i) in menuItems"
        :key="i"
        ref="items"
        :style="i === itemIndex ?chosenStyle:'' "
      >
        {{ item.name }}
      </card-grid>

itemIndex as needs to be individually styled sequence, when the I render time and itemIndex is equal, this component will be separately set a : style = 'chosenStyle' , can achieve the corresponding effect.