Tag Archives: ProgrammerAH

Strange exception 001: invalid or unexpected token

The following error suddenly appears on a query page:

Uncaught SyntaxError: Invalid or unexpected token,

Translated into Chinese:
the captured query is invalid or unexpected
what is this?Careful query code logic completely no problem, a face muddled force, do not know what happened.

Since there is no problem with the code logic, it is a data problem. After checking all the data to be displayed on the page, we found some doubtful points, such as single quotation marks and double quotation marks.

In fact, this error prompt tells us that the data has special characters; The data has special characters; The data has special characters

Error in downloading update creation environment of CONDA: collecting package metadata (current_ repodata.json): failed

CONDA download updates are not available

There are the following problems

  environment variables:
                 CIO_TEST=<not set>
                CLASSPATH=.;C:\Program Files\Java\jdk1.8.0_131\lib
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=F:\conda\anaconda\condabin\..\Scripts\conda.exe
               CONDA_EXES="F:\conda\anaconda\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=F:\conda\anaconda
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=F:\conda\anaconda\python.exe
               CONDA_ROOT=F:\conda\anaconda
              CONDA_SHLVL=1
           CURL_CA_BUNDLE=<not set>
                 HOMEPATH=\Users\Lenovo
                     PATH=F:\conda\anaconda;F:\conda\anaconda\Library\mingw-w64\bin;F:\conda\ana
                          conda\Library\usr\bin;F:\conda\anaconda\Library\bin;F:\conda\anaconda\
                          Scripts;F:\conda\anaconda\bin;F:\conda\anaconda;F:\conda\anaconda\Libr
                          ary\mingw-w64\bin;F:\conda\anaconda\Library\usr\bin;F:\conda\anaconda\
                          Library\bin;F:\conda\anaconda\Scripts;F:\conda\anaconda\bin;F:\conda\a
                          naconda\condabin;C:\Program Files\Java\jdk1.8.0_131\bin;"C:\Program
                          Files\Java\jdk1.8.0_131\jre\bin;";F:\Xshell;C:\Program Files\Microsoft
                          MPI\Bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WIN
                          DOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\IDM Computer
                          Solutions\UltraEdit;C:\Program Files\dotnet;F:\matlab\mat\runtime\win6
                          4;F:\matlab\mat\bin;F:\matlab\mat\polyspace\bin;C:\Program
                          Files\MySQL\MySQL Server 8.0\bin;D:\opencv4\x64\vc16\bin;C:\Program
                          Files\python;C:\Program Files\python\Scripts;F:\_install\BtSoft\panel\
                          script;F:\spss\install\JRE\bin;F:\nodejs\nodejs;F:\phantomjs\phantomjs
                          -2.1.1-windows\phantomjs-2.1.1-windows\bin;F:\graphviz\bin\dot.exe;F:\
                          git\Git\cmd;C:\WINDOWS\System32\OpenSSH;F:\conda\anaconda;F:\conda\ana
                          conda\Library\mingw-w64\bin;F:\conda\anaconda\Library\usr\bin;F:\conda
                          \anaconda\Library\bin;F:\conda\anaconda\Scripts;C:\Users\Lenovo\AppDat
                          a\Local\Programs\Python\Python38\Scripts;C:\Users\Lenovo\AppData\Local
                          \Programs\Python\Python38;F:\python\python\Scripts;F:\python\python;F:
                          \python\python37\Scripts;F:\python\python37;C:\Users\Lenovo\AppData\Lo
                          cal\Microsoft\WindowsApps;F:\idea\idea\IntelliJ IDEA
                          2019.3.3\bin;.;F:\pycharm\PyCharm 2019.3.3\bin;.;C:\Program
                          Files\MySQL\MySQL Server 8.0\bin;F:\pycharm\PyCharm Community Edition
                          2020.3.3\bin;.;C:\Users\Lenovo\AppData\Roaming\npm;F:\graphviz\bin
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
                          PowerShell\v1.0\Modules
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>
           UNRAR_LIB_PATH=C:\Program Files\python\Lib\site-packages\unrar\UnRAR.dll

     active environment : base
    active env location : F:\conda\anaconda
            shell level : 1
       user config file : C:\Users\Lenovo\.condarc
 populated config files : C:\Users\Lenovo\.condarc
          conda version : 4.10.1
    conda-build version : not installed
         python version : 3.8.5.final.0
       virtual packages : __win=0=0
                          __archspec=1=x86_64
       base environment : F:\conda\anaconda  (writable)
      conda av data dir : F:\conda\anaconda\etc\conda
  conda av metadata url : https://repo.anaconda.com/pkgs/main
           channel URLs : https://mirrors.ustc.edu.cn/anaconda/cloud/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/noarch
                          https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/noarch
                          https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/noarch
                          https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/noarch
                          https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/noarch
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/free/win-64
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/free/noarch
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/main/win-64
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/main/noarch
          package cache : F:\conda\anaconda\pkgs
                          C:\Users\Lenovo\.conda\pkgs
                          C:\Users\Lenovo\AppData\Local\conda\conda\pkgs
       envs directories : F:\conda\anaconda\envs
                          C:\Users\Lenovo\.conda\envs
                          C:\Users\Lenovo\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.5 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?

[y/N]: y
Upload did not complete.

Thank you for helping to improve conda.
Opt-in to always sending reports (and not see this message again)
by running

Solution

I’ve tried all the solutions to this problem on the Internet. I’ve also tried to change the source, uninstall and reload CONDA, but it’s not easy to use
finally! I found my network agent on!!! Just turn it off
you can check whether your network agent is on or off. Or refer to the great gods blog to set up a proxy, but I won’t, I just simply and rudely turn it off.

’nvcc.exe‘ failed with exit status 1

F:/study/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(280): error: no instance of function template "THCCeilDiv" matches the argument list
            argument types are: (long long, long)

F:/study/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(280): error: no instance of overloaded function "std::min" matches the argument list
            argument types are: (<error-type>, long)

F:/study/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(327): error: no instance of function template "THCCeilDiv" matches the argument list
            argument types are: (int64_t, long)

F:/stud/easy-faster-rcnn.pytorch-master/support/src/cuda/ROIAlign_cuda.cu(327): error: no instance of overloaded function "std::min" matches the argument list
            argument types are: (<error-type>, long)

4 errors detected in the compilation of "C:/Users/����֮/AppData/Local/Temp/tmpxft_000032d8_00000000-10_ROIAlign_cuda.cpp1.ii".
ROIAlign_cuda.cu
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\bin\\nvcc.exe' failed with exit status 1

Solution
Add (long) to the error

Solve the problem that M1 Mac can’t debug when using GoLand

The general error information is as follows:

API server listening at: [::]:57824
debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1200.0.44
 for x86_64.
error: failed to launch process /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver: (os/kern) invalid argument
Exiting.

I use go 1.16, which supports arm architecture. The reason for this problem is that go debug needs DLV tool, which also needs arm architecture.

The easiest way to solve this problem is to go to the official website to update GoLand. Pay attention to go to the official website to download the latest arm version again. Usually, the update prompted in the IDE can only be regarded as a patch, not a big version update. In this way, the debugging tools of IDE are adapted to arm architecture.

Of course, due to various reasons that cannot be described, some users may not be suitable to go to the official website to update, so you can refer to this link   https://youtrack.jetbrains.com/issue/GO-10235#focus =Comments-27-4632451.0-0

Download the DLV debugging tool of arm architecture, and then configure it in IDE.

Apache Groovy——java.lang.NoSuchMethodError: x.x.x: method <init>()V not found

Original address: Apache groovy — Java. Lang. nosuchmethoderror: x.x.x: method() V not found 🙃)

Problem description

During the execution of groovy code, the following error occurred:

ava.lang.NoSuchMethodError: com.lispstudio.model.TeamLispstudio: method <init>()V not found

Cause of the problem

After inheriting the parent class, the constructor of the parent class is not called.

resolvent

There are two solutions: 1) call the same constructor as the parent class; 2) Use inheritconstructors annotation;

Call the same constructor as the parent class

class Creature {
    Creature (String feature) {}
}

class Humman extends Creature{
    Humman (String feature) {
		super(feature)
    }
}

new Humman("legs")

Using inheritconstructors annotation

class Creature {
    Creature (String feature) {}

WebView load webpage, HTTP call error

Project error:

 "Mixed Content: The page at 'https://wx.vzan.com/live/tvchat-427320897?v=637539910901869888#/' was loaded over HTTPS,
 but requested an insecure video 'http://i3.vzan.cc/m3u8/20200221/a487a8d9b2164043bb632165a0cc129c/v.f24306.m3u8'. 
 This request has been blocked; the content must be served over HTTPS.", 
 source: https://wx.vzan.com/live/tvchat-427320897?v=637539910901869888#/ (0)

Error analysis:

Starting from 9.0 (API level 28) on Android, plaintext communication support is disabled by default, which is officially said to be unsafe. Because the video source we play is HTTP protocol, we can’t play it.

Idea 1: add uses cleartext traffic

Indicates whether the application intends to use plaintext network traffic, such as plaintext http. The default value for applications with a target API level of 27 or lower is “true.”. For applications with API level 28 or higher, the default value is “false”.

 <!--Android 9.0 video playback function-->>
  <application
      android:usesCleartextTraffic="true" 
        >
   
  </application>

After modification, some models are still not feasible.

Idea 2: Android access to x5webview

Better article links: https://www.cnblogs.com/cuichen16/p/10785945.htm
After adding, Android 10.0 or above is not feasible for higher version mobile phones

Idea 3: setmixedcontentmode

//Allow cross-domain
webSetting.setAllowFileAccessFromFileURLs(true);
webSetting.setAllowUniversalAccessFromFileURLs(true);
webSetting.setSupportMultipleWindows(true);
if (Build.VERSION.SDK_INT >= 21) {
	webSetting.setMixedContentMode(android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // This sentence is crucial and can be added after
}

Finally, after adding the above three contents, the last step can be finished. If not, please continue to Baidu and keep looking for the key code.

Elememt UI introduces components on demand to report errors

Background: the project based on vue-cli3 introduces error reporting on demand

According to the official documents, introduce components as required, as follows:
1. Install: NPM install Babel plugin component – d
2 babel.config.js Modify configuration in

module.exports = {
  presets: [["es2015", { modules: false }]],
  plugins: [
    [
      "component",
      {
        libraryName: "element-ui",
        styleLibraryName: "theme-chalk",
      },
    ],
  ],
};

3. After running, Babel compiles and reports an error:
cannot find module ‘babel-preset-es2015’
4. Query the document and find the following sentence:
this preset is not recommended. If you want to keep it up to date, please use env preset
5. Solution:
1) install NPM install — save dev @ Babel/preset env
2) modify babel.config.js “Es2015” is “@ Babel/preset env”
3)

Official website link reference: https://babel.docschina.org/docs/en/6.26.3/babel-preset-es2015/

Nginx Error: [emerg] bind() to [::]:80 failed (98: Address already in use)

Problem description

When starting the nginx service, the following error occurred:

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
...

Cause of the problem

There are many reasons for this problem. We will list our scenarios and solutions here.

First, the port is occupied

This is the most common reason. Port 80 is occupied, which leads to binding of nginx service.

Solution 1

Find the process occupying port 80 and end it.

Second, dual stack sockets for IPv6

This is a common problem in the transition period from IPv4 to IPv6. The following configuration will also cause the above error:

server {
    listen [::]:80 ipv6only=off;        
    server_name dual-stack.example.com;
}
server {
    listen 0.0.0.0:80;
    server_name ipv4.example.com;
}

With the IPv6 only = off option, the currently created socket is dual stack, and IPv4 will be mapped to IPv6. At this time, only one monitor can be created, and IPv4 can no longer be monitored.

Solution 2

Since we can’t monitor IPv4, and now it’s a dual stack, we can monitor IPv6 address safely (and ensure IPv4 access at the same time)

server {
    listen [::]:80 ipv6only=off;        
    server_name dual-stack.example.com;
}
server {
    listen [::]:80;
    server_name ipv4.example.com;
}
# Because of the specific scenario, we cannot modify the configuration of the first Server
# Of course, it is also possible to turn off the double stack.