Tag Archives: HTML5

[Solved] Vue cli installation Fastclick Error

When I installed the fastsclick package into the vue-cli dependency today, it reported an error saying

$ npm install fastclick –save
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npm.taobao.org/fastclick failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2021-04-15T12_07_17_780Z-debug.log

Eventually switched to a different installation, typing in the command line.

cnpm install fastclick –save
Success

Vscode HTML file auto supplement HTML skeleton failure

Vscode HTML files automatically supplement HTML skeleton invalidation

Input! +Tab key to complete HTML skeleton failure

terms of settlement:

1. Let the HTML file be in editing state, press the shortcut key Ctrl + Shift + P

2. Enter change language mode in the jump dialog box, find the “HTML” configuration file in the drop-down options bar and set it

Vue warn: duplicate keys detected: ‘1’. This may cause an update error

[VUE WARN]: Duplicate keys detected: ‘1’. This may cause an update error. :

/ font>


Problem description:


Reason analysis:
> Keys value binding problem
My problem is my problem when doing the project binding:

here my page rendering is based on id to apply colours to a drawing


Solution:


br>

uniapp e. currentTarget.dataset Pay attention

There is a problem with uniapp. When you compile to H5, you can get the data, but you can’t get the data in the WeChat applet
As shown in figure:

Then, at the prompt, add console.log to the relevant code to see the output
It turns out that there was an error adding a label to the element

Look at both sides of the console to find the reason:
H5:

WeChat applet:

The WeChat applet converts uppercase letters to lowercase
Fix: Change the data-trailerID in HBuilderX to all lowercase

Installing and uninstalling nodejs in Linux

Installation:
1. Download
Uname -a to view the Linux system version, go to the NodeJS official website to download the corresponding NodeJS compressed file
 
2. Upload & amp; Unpack & amp; renamed
Yum install -y LRZSZ and install the file node-v10.16.0-linux-x64.tar.xz. If you want to install LRZSZ, do not install the file node-v10.16.0-linux-x64.tar.xz.
⑵ Unzip tar-xvf node-v10.16.0-linux-x64.tar.xz. ⑵ Unzip tar-xvf node-v10.16.0-linux-x64.tar.xz
⑶ Rename it to nodejs: mv node-v10.16.0-linux-x64 nodejs
 
3. Establish soft connection and make it global (APP is the directory where I installed NodeJS)
(1) ln -s/app/nodejs/bin/node/usr/local/bin /
2 ln -s/app/nodejs/bin/NPM/usr/local/bin /
 
4. Check global
Any position node – v view nodejs version of NPM – v view NPM version number, such as display shows successful installation
 
Uninstall:

yum remove nodejs NPM -y
yum remove nodejs NPM -y
yum remove nodejs NPM -y
 
2. Manually delete residual files
Go to /usr/local/lib and delete all nodes and node_modules
go to /usr/local/include and delete all nodes and node_modules
to /usr/local/bin and delete all nodes’ executables
 
3. If you need to install again, follow the above installation method

Ueditor paste word image and upload image file automatically

Tinymce is a very good rich text editor, you can go to the website to download. https://www.tiny.cloud
Here is the source code of PowerPaste, a paid plug-in on its official website, but it does not affect the use of functionality.

umeditor+粘贴word图片


Take Vue as an example:
Install Tinymce under static directory instead of NPM.
PowerPaste is put in the \static\tinymce\plugins directory


Introducing tinymce.min.js in index.html.


Code parameter configuration is shown in the figure below:


Replace paste in plugins with powerpaste and you’re done.
The final effect, can automatically batch upload all the images in Word

After the picture is uploaded, the image address in the editor is changed to the image address of the server.

Nuxt cannot find the static resource in static

Nuxt cannot find the static resource inside static reason
The old VUE project was migrated because the project needed it. Then follow the tutorial to create the SRC folder in Nuxt, and that’s why. Because the initial directory for srcDir is set. So I can’t find the folder outside of SRC.
Solution: Don’t put old project folders in SRC. Follow the folder location where the project was created to

PHP big file upload problem (500m or above)

An overview,
 
A breakpoint is simply a download, which means to continue downloading a file from where it has already been downloaded. Breakpoints were not supported in previous versions of the HTTP protocol, and HTTP/1.1 has been since. The Range and content-Range headers are usually used for breakpoints. HTTP protocol itself does not support breakpoint upload, you need to implement their own.
 
Second, the Range
 
Used in the request header to specify the position of the first byte and the position of the last byte, in general format:
 
Range: For client-to-server requests, you can change a field to specify the size and unit of a download file. Byte offset starts at 0. Typical format:
Ranges: (unit=first byte Pos)-[last byte Pos]
Ranges: Bytes =4000- Download from the beginning of byte 4000 to the end of file
Ranges: Bytes =0~N to download contents in the 0-n byte range
Ranges: Bytes = M-n to download contents in the M-n byte range
Ranges: Bytes = -n to download the last N-byte content

 
1. The following points should be noted:
(1) The data interval is a closed interval with a starting value of 0, so a request like “Range: Bytes =0-1” is actually two bytes at the beginning of the request.
(2) “Range: Bytes =-200”, which does not represent the 201 bytes at the beginning of the request file, but the 200 bytes at the end of the request file.
(3) If the last Byte POS is less than the first Byte POS, then the Range request is invalid. The server needs to ignore the Range request, then respond with a 200, and send the entire file to the client.
(4) If the last Byte POS was greater than or equal to the file length, then the Range request was considered unsatisfiable and the server needed to respond to a 416, Requested Range not Satisfiable.
 
2. Example explanation:
Bytes =0-499 bytes
Bytes =500-999 bytes
Bytes =-500 bytes
Bytes =500- = range after 500 bytes
First and last bytes: Bytes =0-0,-1
Also specify a range: Bytes =500-600,601-999
 
Third, the Content – Range
 
Used in the response header to specify the insertion location of a portion of the entire entity, which also indicates the length of the entire entity. Before the server returns a partial response to the client, it must describe the extent of the response coverage and the entire entity length. General format:
 
Content-range: Bytes (Unit first Byte pos) – [Last Byte pos]/[Entity Legth]
 
4. Header examples
 
Request to download the entire file:
 
GET/test. Rar HTTP/1.1
Connection: close
Host: 116.1.219.219
Range: Bytes =0-801 // Bytes =0- Or don’t use this header
 
General normal response
 
HTTP/1.1 200 OK
The Content – Length: 801
The content-type: application/octet stream
Content-range: Bytes 0-800/801 //801: Total file size
 
The simplest breakpoint continuation implementation is as follows:
1. The client has downloaded a 1024K file, of which 512K has been downloaded
2. The network is interrupted, and the client requests the continuation of transmission. Therefore, it is necessary to declare the fragment to be continued this time in the HTTP header:
Range:bytes=512000-
This header tells the server to transfer the file from the 512K location of the file
3. The server receives the breakpoint to continue the transmission request, starting from the 512K position of the file, and adds in the HTTP header:
Content-Range:bytes 512000-/1024000
And the server should return an HTTP status code of 206 instead of 200.
However, in a real scenario, the content of the file corresponding to the URL has changed at the server side when the terminal initiates the continuation request, and the data of the continuation is definitely wrong. How to solve this problem?Obviously at this point we need a way to identify the uniqueness of the file. There is also a definition in RFC2616, such as last-modified to indicate the Last modification time of a file, so that you can determine whether any changes have been made during the continuation of the file. Also defined in RFC2616 is an ETag header that can be used to place a unique identifier for a file, such as the MD5 value of the file.
When a terminal initiates a continuation request, it should declare the IF-match or IF-modified-since fields in the HTTP header to help the server identify file changes.
In addition, there is also an IF-range header defined in RFC2616. If the terminal USES iF-range in continuation. The content in the IF-range can be the first ETag header received or the Last modification in the Last-ModFIED. When the server receives the continuation request, it verifies through the contents in the IF-range. If the verification is consistent, it returns the continuation reply of 206; If not, it returns 200. The content of the reply is all the data of the new file.

the relevant reference links: http://blog.ncmem.com/wordpress/2019/08/09/http%e6%96%ad%e7%82%b9%e7%bb%ad%e4%bc%a0/
welcome into the group to discuss: 374992201

DOMException: play() failed because the user didn‘t interact with the document first

error is due to the new feature of chrome, which basically means that developers cannot use their permissions to cause noise interference to users, and users need to interact with audio/video

to load the page for the first time

The requirements are as follows:
refresh the alarm list in real time to ensure the user gets the latest alarm message. When there is a new alarm message, sound the alarm bell

solution

enable alarm bell to prompt users when they first enter the page

let audioPlay = document.getElementById('myaudio')

audioPlay.play()

setTimeout(() => {
  audioPlay.pause()
  audioPlay.load()
}, 10)

click to interact with audio for the first time, set 10 milliseconds and the user will not hear the bell. Set the alarm time to

when using again

How to restrict input field to only input pure numbers in HTML

limit input input box can only enter pure Numbers

1, the onkeyup = "value, value = replace (/ [^ \] d/g,") "

USES the onkeyup event, and has the bug, that is, in the state of Chinese input method, after Chinese characters are input, enter directly, the letter

will be input directly

2, onchange = "value, value = replace (/ [^ \] d/g,") "

USES the onchange event. After input content, only the input loses focus will get the result, and the response

cannot be made when input

3, the oninput = "value, value = replace (/ [^ \] d/g,") "

USES the oninput event, which perfectly solves the above two problems. There are no other problems in the test for the time being.

code example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>input</title>
</head>
<body>
    只能输入纯数字的输入框:<input type="text" name="" oninput="value=value.replace(/[^\d]/g,'')">
</body>
</html>

above code has been tested in Google, firefox, baidu, UC, IE11, 360 fast, QQ, Edge browser, please feel free to use,

thanks for qq_38726717, xiao xiao xin feedback in the comments section.