Tag Archives: windows

To solve the problem that windows Remote Desktop Services cannot copy and paste: restart rdpclip.exe

After connecting to the remote server, even if you select the “clipboard” function in the “local resources” tab, you still can’t copy and paste. The solution is found through Baidu, because the rdpclip.exe on the remote server doesn’t work properly. The solution is to open the task manager on the remote server, find the rdpclip.exe process, and close it.

Then enter rdpclip.exe in the start menu search box, press enter, and it will run again.

In windows, “cmake” is not an internal or external command, nor a runnable program or batch file.

1、 Problem description.

An error is reported when cmake is performed under Windows: ‘cmake’ is not an internal or external command, nor is it a runnable program or batch file.

2、 Problem analysis.

Lack of tool cmake.

3、 Solutions.

Install cmake. website: https://cmake.org/download/

When installing cmake, choose to add environment variables.

 

Error c3861: “strcasecmp”: identifier not found

1、 Problem description.

The C/C + + program compiles normally in Linux, and an error is reported in Windows: error c3861: “strcasecmp”:   Identifier not found.

2、 Problem analysis.

There is no library function related to strcasecmp in windows.

3、 Solutions.

Declare the library function of strcasecmp under windows.

#ifdef _WIN32
	//#define strcasecmp _stricmp
	//#define strncasecmp _strnicmp
#endif
#ifdef _MSC_VER
	#define strcasecmp _stricmp
	#define strncasecmp _strnicmp
#endif

 

Asp.netcore project publishing and deploying to IIS needs aspnetcore module v2

PS: the. Net framework can be directly published and can be accessed normally when specified by IIS. However, the aspnetcore project is slightly different. An additional module needs to be installed. If it is not installed, an HTTP error of 500.19 – internal server error will be reported.

1. Official version address: https://dotnet.microsoft.com/download/dotnet

Find the version 3.1 or 5.0 and click to enter.

2. Page   IIS runtime support (asp.net core module V2), that is, IIS running support needs modules. In the windows column, click download.

3. For aspnetcore 3.1, Download dotnet-hosting-3.1.15-win.exe and install it. Then you can see aspnetcore module V2 in the module of IIS

jemter java.net.BindException:Address alreardy in use [How to Solve]

Phenomenon:

reason:

Windows itself provides port access mechanism.

Windows provides TCP/IP link ports of 1024 ~ 5000, and it takes 4 minutes to recycle these ports. At this time, if we run a large number of requests in a short time, the ports will be full.

Solution:

win + r   Enter regedit to open the registry   Find the following path

Computer_ LOCAL_ MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Right click parameters to create a new DWORD   The name is maxuserport   The value is 65534 (maximum 65535, set 65534 to prevent all ports from being occupied)

Right click parameters to create a new DWORD   The name is   TCPTimedWaitDelay   Value is 30 (default unit is seconds)

Reference: HTTPS://support.microsoft.com/zh-cn/help/196271/when-you-try-to-connect-from-tcp-ports-greater-than-5000-you-recover-t

Making Python script into exe command under Windows

Making Python script into exe command under Windows

Method 1: use windows batch processing (Windows command script)

    create a new fanyi.bat file, which is as follows.

    @echo off
    python3 D:\test\fanyi.py %1
    
      add the current folder to the environment variable, re open a CMD window, and enter the command Fanyi Hello

      The second method uses pyintaller module to generate EXE file

        install pyinstaller module

        pip install pyinstaller
        
          enter the D: [test directory, and execute the generate command

          pyinstaller fanyi.py
          

          Generated fanyi.exe The file is in the D::

            add the folder to the environment variable and execute the command in CMD

MySQL driver compiling method of QT under windows and solutions to abnormal errors

2015-11-20

Recently, in the process of compiling QT’s MySQL driver with MinGW under windows, it was compiled through several twists and turns. In the process of compiling, there are many problems. In order to avoid similar errors in the subsequent driver compilation and facilitate the rapid completion of this driver compilation, the compilation methods are sorted out.

This method is illustrated by a case of my own compiling environment.

1、 Compiling environment

Operating system: win7 64 bit

MySQL service version: mysql-5.5.46-win32

QT version: 4.8.6

Compiling environment: MinGW 64 bit

2、 Compilation steps

(1) Generate libmysql. A file

Because MinGW compiler needs to use “. A” suffix static library file to connect with static library, but according to MySQL database, there is only “. Lib” format static library, so it needs to be converted. Two tools are needed for conversion reimp.exe and dlltool.exe The paths of these two tools need to be configured in the path environment variable. The conversion command is as follows:

First of all, open the CMD command input box and enter the Lib path under the MySQL installation path. For example, my path is: “C:// program files (x86)  MySQL  MySQL server 5.5  lib”.

Next, enter the following commands in turn:

reimp -d  libmysql.lib

dlltool -k -d  libmysql.def  -l libmysql.a

After successful execution, you can view the library file of libmysql. A in this path.

(2) Editor mysql.pro Engineering documents

Find it in the installation path of QT mysql.pro The path of my pro file is: “C:// Qt/4.8.6/SRC/plugins/sqldrivers/MySQL”.

open mysql.pro File, add the following configuration below:

INCLUDEPATH+=”C:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/include/”

LIBS+= -L”C:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/lib/” –llibmysql

The second line can also be written as follows:

LIBS+= “C:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/lib/libmysql.a”

Makefile Makefile.Debug 、 Makefile.Release Three makefile files and others. As shown in the figure below:

(3) Edit makefile file

Take the debug version as an example. open Makefile.Debug File, find LIBS = “XXXX” line and modify it. Because there is a problem with this configuration generated.

The original configuration is as follows:

LIBS = -L”c:\Qt\4.8.6\lib”debug\qsqlmysqld_ resource_ res.o -llibmysql “-LC:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/lib/” -llibmysql -lQtSqld4 -lQtCored4

According to our intention, according to makefile’s syntax rules, we can clearly find the problem. First of all, “L” must be placed outside the path of the configuration library. Second, the – llibmysql command has repetition.

It is revised as follows:

LIBS = -L”c:\Qt\4.8.6\lib”debug\qsqlmysqld_ resource_ res.o -L “C:/Program Files(x86)/MySQL/MySQLServer 5.5/lib/” -llibmysql -lQtSqld4 -lQtCored4

Or it can be modified as follows:

LIBS = -L”c:\Qt\4.8.6\lib”debug\qsqlmysqld_ resource_ res.o “C:/Program Files(x86)/MySQL/MySQL Server5.5/lib/libmysql.a” -lQtSqld4 -lQtCored4

The release version of makefile is modified in the same way.

(4) Execute the make command

Use the mingw32 make command to execute makefile. If no parameter is added, it will be executed by default Makefile.Debug . You can write debug or release or both after mingw32 make command to execute the corresponding version of makefile.

For example, execute debug and release makefile at the same time. The command is as follows:

mingw32-make debug release

After successful execution, you can see qsqlmysqld. A qsqlmysqld.dll Two library files, in the release folder, see qsqlmysql. A qsqlmysql.dll Two library files.

These four library files are the static library and dynamic library driven by MySQL of debug and release versions.

(5) Copy the driver file to the specified directory

Copy the four driver files generated in the previous step to the database driver directory of QT, that is, under the path of “C:: (QT) ﹣ 4.8.6 ﹣ plugins ﹣ sqldrivers”.

(6) Copy libmysql.dll File to specified directory

Install the libmysql.dll Copy the dynamic library file to the bin directory of QT, i.e. “C:// Qt/4.8.6/plugins/sqldrivers”. At this point, use QT to write a program to connect to MySQL database.

3、 Test whether the driver is available

Write demo program to test QT driver. The main codes are as follows:

#include <QtCore/QCoreApplication>  

#include <QDebug>  

#include <QStringList>  

#include <QString>  

#include <QSqlDatabase>  

int main(int argc, char *argv[])  

{  

    QCoreApplication a(argc, argv);  

    qDebug()<<“Available drivers:”;  

    QStringList drivers = QSqlDatabase::drivers();  

    foreach(QString driver,drivers)  

    qDebug()<<“\t”<<driver;  

    return a.exec();  

}  

Add in project file

QT       +=sql

Running this demo program, you can see “qmysql3” and “qmmysql” in the list of available drivers. As shown in the figure below:

4、 Common problems and Solutions

(1) Cannot find – llibmysql

“- llibmysql” cannot be found because the configuration in makefile is incorrect. After modifying Makefile, compile it again, and the compilation passes.

The solution to this problem is: check the configuration in Makefile, modify it to conform to the rules of makefile syntax, and then try again.

(2) Undefined reference to ‘MySQL’_ character_ set_ name@4 ’

This situation, as well as a series of undefined references related to MySQL, is due to a problem loading the MySQL library. After online query of relevant information, we know that it is the version problem of MySQL database. When using the link library in 64 bit MySQL database, we will report this error.

The solution is to install a 32-bit MySQL database and configure it mysql.pro File, compile the driver again, and the error will not appear again.

(3) Unrecognized command line option \ “- fno keep inline dllexport \”

The reason for this error is that the version of the compiler is relatively low. To query the version of the currently used gcc compiler is GCC – 4.4.0. The explanation of the online information is as follows:

this is because\”-fno-keep-inline-dllexport\” is the option of mingw 4.6.1, but i’musing 4.5. So I change it by installingcodelite-3.5.5377-mingw4.6.1-wx2.9.2.exe

The translation is as follows:

This is because the option “- fno keep inline dllexport” is a function of mingw4.6.1. The current version is too low, so the gcc compiler of version 4.6.1 or above is needed.

Later, the MinGW compiler environment of 4.8.1 version of gcc compiler was installed. When compiling this driver, the above error disappeared.

Therefore, the solution to this problem is to install the gcc compiler above 4.6.1.

Method of canceling anydesk startup under Windows

Anydesk, a remote connection tool, is not used frequently after installation. It starts automatically every time it is turned on. It takes up resources. Hanging it in the windows tray is very eye-catching.

The solution is as follows:

In the start folder of the start menu, find anydesk, right-click and select Delete.

complete

Android gets the height and width of the screen

Android gets the height and width of the screen and uses the WindowManager class

There are two methods

1、WindowManager wm = (WindowManager) getContext()
                    .getSystemService(Context.WINDOW_SERVICE);

     int width = wm.getDefaultDisplay().getWidth();
     int height = wm.getDefaultDisplay().getHeight();

2、WindowManager wm = this.getWindowManager();

     int width = wm.getDefaultDisplay().getWidth();
     int height = wm.getDefaultDisplay().getHeight();

Solution — windows 2012 installation Framework 3.5 in VMWare

Solution – Windows 2012 installation Framework 3.5 in VMWare

Mount the system image
, open the server manager, click “add roles or functions”
next
next
next
do not need to operate here, directly next
check Framework 3.5 here, and then next
click specify alternate source path option
A289885427 here you need to fill in the alternate source path
open the mounted system image, enter the specified location, copy the path
fill in the alternate source path, confirm, and then click Install
to start the installation, wait for the installation to complete
to finish the installation, and then close VMware.

Kill Tomcat process in windows and Linux environment (solve the problem of other ports being occupied)

Killing process in Windows

1. First of all, find out the PID of the process number that occupies port 8080 ( tomcat, the default is port 8080. If you modify the monitoring port of tomcat, please write in your Tomcat port number or other port numbers ) what I query is port 7777

​netstat -ano | findstr 8080

The last column of the command output indicates the number of the process occupying port 7777, assuming 10976

2. Kill the process, thus freeing the port

taskkill /f /pid 10976 

 

 

Closing Tomcat process under Linux operating system

1. See if Tomcat is already running

ps -ef |grep tomcat 

If Tomcat is running, the result will be similar to the following:

sun 5144 1 0 10:21 pts/1 00:00:06 /java/jdk/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

-Djava.endorsed.dirs=/java/tomcat/common/endorsed -classpath :/java/tomcat/bin/bootstrap.jar:/java/tomcat/bin/commons-logging-api.jar

-Dcatalina.base=/java/tomcat -Dcatalina.home=/java/tomcat -Djava.io.tmpdir=/java/tomcat/temp org.apache.catalina.startup.Bootstrap start

From the above output information, we can know that the process number of Tomcat execution is 5144.

2. Execute the following command to kill the 5144 process

pid = 5144 kill -9 5144 

3. Get the occupancy of a certain port (for example, get the occupancy of port 5533 below)

sudo lsof -i :5533

The result is as follows: you can see that the process number is 2960, we just need to kill it.

COMMAND  PID        USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    2960 zhengcanrui   55u  IPv6 0xb866409b03202701      0t0  TCP *:5533 (LISTEN)

Kill process command:

kill -9 2960