Tag Archives: ProgrammerAH

Golang Warning: Error string should not be capitalized or end with punctuation mark

Error string should not be capitalized or end with punctuation mark
The error string should not be capitalized or punctuated

When we use errors. New (“AAA.”) or fmt.Errorf(“Aaa.”)   When the form returns error information, the text content should not start with a capital letter or end with a punctuation mark.

Only modify according to the warning, remove the beginning of capital letter and the end of punctuation. Errors. New (“AAA”)

MYSQL Enter password:ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘

[mysqld]
# Set port 3306
port=3306
# Set the mysql installation directory
basedir=E:\\software\\\mysql\\mysql-8.0.11-winx64 # Remember to use a double slash here \\\, single slash I will get an error here, but look at other people's tutorials, some are single slash. Try it yourself
# Set the mysql database data storage directory
datadir=E:\software\\\mysql\\\mysql-8.0.11-winx64\\\Data # Same as above here
# Maximum number of connections allowed
max_connections=200
# The number of failed connections allowed. This is to prevent someone from that host from trying to attack the database system
max_connect_errors=10
# The default character set used on the server is UTF8
character-set-server=utf8
# Default storage engine to be used when creating new tables
default-storage-engine=INNODB
# Default authentication with "mysql_native_password" plugin
default_authentication_plugin=mysql_native_password
[mysql]
# Set the default character set for mysql client
default-character-set=utf8
client]
# Set the default port used by mysql clients when connecting to the server
port=3306
default-character-set=utf8

[Solved] Error running ‘LocalTest‘: Command line is too long. Shorten command line for LocalTest or also for…

Error running ‘Application’:
Command line is too long.Shorten command line for Application or also for Spring Boot default configuration.
IDEA reports the above error, add the following content to the project workspace.xml

  <component name="PropertiesComponent">
    //add
    <property name="dynamic.classpath" value="true" />
  </component>

[Solved] failed to req API:/nacos/v1/ns/instance after all servers

Scenario: CentOS virtual machine SpringCloud-Nacos Dubbo integration error reporting
failed to req API:/nacos/v1/ns/instance after all servers([192.168.56.101:8848, 192.168.56.102:8848, 192.168.56.103:8848]) tried: failed to req API:192.168.56.102:8848/nacos/v1/ns/instance. code:400 msg: <html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id=’created’>Fri May 21 01:29:11 CST 2021</div><div>There was an unexpected error (type=Bad Request, status=400).</div><div>receive invalid redirect request from peer 192.168.56.101</div></body></html>
Cause.
When the nacos service is started, the virtual machine’s enp0s3 NIC is used with an ip of 10.0.2.x
And 192.168.56.x is the address of the enp0s8 NIC
So the solution here is to open the configuration item in /nacos/conf/application.properties and specify the ip on it

Solving routing errors by rewriting Vue push method

/**
Rewrite the push method of the route
Solve the problem of reporting an error when jumping on the same route
Add, when same route jump, trigger watch (string only, like “view?id=5″)
*/
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
if(typeof(location)==”string”){
var Separator = “&”;
if(location.indexOf(‘?’)==-1) { Separator=’?’; }
location = location + Separator + “random=” + Math.random();
}
return routerPush.call(this, location).catch(error=> error)
}

How to Solve error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe‘ failed

Perfect solution error: Command ‘C’: program files, NVIDIA GPU computing toolkit, CUDA, v11.0, bin, nvcc.exe ‘failed with exit status 1

[win10 install detectron2]

My compiling environment:

pytorhc:1.8.1+cu111

cuda11.0

Download first https://github.com/facebookresearch/detectron2, then go to the file directory, then go to the command line, and then run

python setup.py build --force develop

Then came the problem:

E:/。。。/detectron2-master (3)/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): error: identifier "single_box_iou_rotated" is undefined
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

E:/。。。/detectron2-master (3)/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): error: type name is not allowed
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

E:/。。。/detectron2-master (3)/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(68): warning: expression has no effect
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

E:/。。。/detectron2-master (3)/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(58): warning: variable "cur_box" was set but never used
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

5 errors detected in the compilation of "E:/。。。/detectron2-master (3)/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu".
nms_rotated_cuda.cu
C:\Users\。。。\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:369: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
C:\Users\。。。\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:311: UserWarning:

                               !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (cl 19.00.24210) may be ABI-incompatible with PyTorch!
Please use a compiler that is ABI-compatible with GCC 5.0 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.

See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
for instructions on how to install GCC 5 or higher.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                              !! WARNING !!

  warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.0\\bin\\nvcc.exe' failed with exit status 1

After solving the problem, run the command again and install it successfully,

Perfect solution to raise runtimeerror (“distributed package doesn’t have nccl”) in Windows system“

The following issues arise during training.
File “C:\Users\urser\anaconda3\lib\site-packages\torch\distributed\distributed_c10d.py”, line 597, in _new_process_group_helper
raise RuntimeError(“Distributed package doesn’t have NCCL ”
RuntimeError: Distributed package doesn’t have NCCL built in
From the text, the error message is obvious, there is no NCCL
and windows does not support NCCL backend.
Let’s look at the official documentation.
As of PyTorch v1.8, Windows supports all collective communications backend but NCCL, If the init_method argument of init_process_group() points to a file it must adhere to the following schema:
And to solve this problem is also very simple, do not use NCCL backend.
Only one line of code is needed to solve the problem.

The showdialog() method in thread/threading. Timer/task reported an error: “before ole can be called, the current thread must be set to single thread unit (STA) mode.”

Before ole can be called, the current thread must be set to single threaded unit (STA) mode. Make sure that your main function is marked with stathreadattribute.

Error environment:

1. In the thread thread, call the showdialog() method

2. In the thread timer, call the showdialog() method

3, calling the ShowDialog() method in the Task task.

Error exception:

When the. Showdialog() method is executed, the following error will appear: “before ole can be called, the current thread must be set to single threaded unit (STA) mode. Please make sure that your main function is marked with stathreadattribute.”

Error reason:

1. First of all, make sure that the main entry of the program is marked with stathreadattribute. If not, please add [stathread] to see if the problem is solved

2. Because this operation is executed in the newly created thread, the UI cannot be accessed, that is, calling ShowDialog () directly is indeed problematic. Non UI thread cannot open window

Solution:

1. Thread

By setting the apartmentstate property of the thread to apartmentstate   Enumeration value that controls the type of cell created.

Among them:

Sta: thread will create and enter a single thread unit;

MTA: thread will create and enter a multi thread unit;

Unknown: the apartmentstate property has not been set.

The code is as follows:

Thread th = new Thread(()=> new Form1().ShowDialog());
th.SetApartmentState(ApartmentState.STA);
th.Start();

This is a common practice on the Internet

2. System.threading.timer

See below!!

3. Task

Task encapsulates task, work content, not thread. A task may be executed on any thread, so the task does not provide thread properties, and the thread class should not be used in asynchronous methods. Moreover, the apartmentstate property of the thread should not be modified in the task, because the thread may execute other tasks. In other words, sta thread cannot be thread pool thread!!   See below!!


So!! Big move here!!!

👉 Multithreading interface should use control. Invoke delegate to let UI thread do it by itself 👈

this.Invoke(some   delegate);// Synchronization
or
this.begininvoke (some)   delegate);// Asynchronous

The code is as follows:

private void button1_Click(object sender, EventArgs e)
{
    Func<string> func = OFD;
    Task task = new Task(() =>
    {
        string res = (string)this.Invoke(func);//Synchronize! Let the UI threads do it themselves
    });
    task.Start();

}
private string OFD()
{
    OpenFileDialog dlg = new OpenFileDialog();
    if (dlg.ShowDialog() == DialogResult.OK)
    {
        string path = dlg.FileName;
        return path;
    }
    return null;
}