Category Archives: Windows

Windows 10 Run Docker Desktop Error: WSL 2 installation is incomplete

Error reporting description

When we install docker desktop, he will ask us whether we need to use wsl2 (Windows based Linux subsystem). If it is not applicable, we will use Hyper-V virtual machine to run. However, compared with virtual machine, the subsystem has better performance. After we choose to use wsl2, and we also confirm that the windows function shown in the figure below is turned on

After installing docker desktop for windows10 operating system, the following prompt window appears after startup: WSL 2 installation is incomplete

Error reporting solution

According to the error prompt, it is speculated that the wsl2 version we use is old and needs to be updated manually. According to the prompt, we go to Microsoft’s official website to download the latest version of wsl2 and open it normally after installation.

How to Share Files Between Linux and windows

1. Create users, directories and installation packages
yum install samba smbfs
useradd -s /sbin/nologin yunwei
smbpasswd -a yunwei
mkdir -p /date/yunwei
chmod 777 /data/yunwei
2. Configuration file
cp /etc/samba/smb.conf /etc/samba/smb.confbak
vi /etc/samba/smb.conf
[homes]
comment = Home Directories
valid users = %S
browseable = No
writable = yes
create mode = 0664
directory mode = 0775

[yunwei]
comment = yunwei
path = /data/yunwei
public = no
valid users = @yunwei
write list = yunwei
printable = no

3. Start the service
Red Hat Enterprise Linux Server release 6.4 (Santiago)
/etc/init.d/smb start
service smb reload
linux 7
systemctl start smb
systemctl status smb
4. Test the use of
windows => run =>
\\ip\yunwei

[Solved] C# Windows service reports an error when the service is started. The service did not respond to the start or control request in time, error code 1053

There are many reasons:

1. There are bugs in the service program, so write your own test methods to troubleshoot.

2. The service program uses the System.Configuration.ConfigurationManager class library to try to read the configuration items under app.config, etc.

After installing the service, the path found by System.Configuration.ConfigurationManager is no longer the path where the original exe is located, so it cannot be used;

You can also write xml or Json configuration file absolute path to read.

3. The OnStart method takes too long to respond to the logic. It is recommended to make asynchronous calls, such as opening a child thread or using a timer. For example:

 1 System.Timers.Timer _timer = new System.Timers.Timer();
 2 protected override void OnStart(string[] args)
 3         {
 4             try
 5             {
 6                 int _interval = 1000 * 60 * interval;
 7                 _timer.Interval = _interval;
 8                 _timer.AutoReset = true;
 9                 _timer.Elapsed += new System.Timers.ElapsedEventHandler(Time_Elapsed);
10                 _timer.Enabled = true;
11                 WriteLog.SaveInfoLog("服务已启动");
12             }
13             catch (Exception ex)
14             {
15                 WriteLog.SaveExceptionLog(ex.Message);
16             }
17 
18         }
19 private void Time_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
20         {
21             try
22             {
23                 if (!isRun)
 24                  {
 25                      // Call business method 
26                  }
 27              }
 28              catch (Exception ex)
 29              {
 30                  WriteLog.SaveExceptionLog( " Error: " + ex.Message);
 31              }
 32          }

4. Check the .Net FrameWork version.

5. Check whether the service name in the serviceInstaller control property of ProjectInstaller is consistent with the started service name.

[Solved] Windows Variable packing error: Property ‘XXX‘ does not exist on type ‘Window‘

Scenario:

In the h5 of the app, the app injected a global window object to interact with the page in the webview, and an error was reported when it was packaged.

Solution:

method one:

(window as any).xxx

Change window.jigsaw.init(()); directly in the component to (window as any).jigsaw.init(());

Method Two:

declare global {
interface Window {xxx: any;}
}

window.xxx = window.xxx|| {};
Method three:

interface MyWindow extends Window {
xxx(): void;
}

declare var window: MyWindow;

[Solved] Python celery Run on Windows Error: (ModuleNotFoundError: No module named ‘grp’)

This article mainly introduces the reason and solution of the error report when using celery to run on Windows in Python: mport grp ModuleNotFoundError: No module named’grp’.

Run the command:

celery -A tasks worker --loglevel=INFO

Error message:

File "d:\cjavapy\celery-demo\venv\lib\site-packages\celery\platforms.py", 
line 9, in import grp ModuleNotFoundError: No module named 'grp'

problem causes:

Using the PyPi package django-celery-beat, it will install the latest version of the required package celery instead of installing a compatible version (when I publish this content, that is, May 25, 2021, at this time v5.1.0), it seems to be compatible with django-celery-beatVersion 2.2.0 (the latest) and Windows operating system have compatibility issues.

Related instructions : https://docs.celeryproject.org/en/stable/changelog.html#id2

Solution:

pip uninstall celery
pip install celery==5.0.5

The Chrome browser cannot remember the password and does not prompt to save the password win10 [How to Solve]

The Chrome browser cannot remember the password and does not prompt to save the password. Solution (win10): Go
to the C:\Users\your username\AppData\Local\Google\Chrome\User Data\Default directory to
delete Login Data and Login Data-journal Two files, restart the browser

[Solved] Windows Django Error: A server error occurred. Please contact the administrator.

This is because the get function is used in the view function to get data that does not exist
For example, there is no data in the database with the name hello1, use the following statement to access
message = Message.objects.get(name='hello1')

will report an error message = Message.objects.get(name='boddy1')

Solution.
 See the following figure:

Click the link in the box above to automatically enter line 323 of the debug.py file, and modify line 321 as shown in the figure below:

Run again:

In this case, the error message is normal, the query data does not exist

This problem does not exist in MAC and Linux, where the encoding has been set to utf8 by default.

Missing processing of api-ms-win-crt-process – | 1-1-0.dll [How to Solve]

After installing Python 3.6, I found that the prompt api-ms-win-crt-process-l1-1-0.dll is missing

The Windows Universal C Runtime library (Universal C Runtime) is installed to the system via Windows Update update with the number KB2999226 (10.0.10240.16390) or KB3118401 (10.0.10586.9) with the following components.

api-ms-win-core-file-l1-2-0.dll

api-ms-win-core-file-l2-1-0.dll

api-ms-win-core-localization-l1-2-0.dll

api-ms-win-core-processthreads-l1-1-1.dll

api-ms-win-core-synch-l1-2-0.dll

api-ms-win-core-timezone-l1-1-0.dll

api-ms-win-core-xstate-l2-1-0.dll

api-ms-win-crt-conio-l1-1-0.dll

api-ms-win-crt-convert-l1-1-0.dll

api-ms-win-crt-environment-l1-1-0.dll

api-ms-win-crt-filesystem-l1-1-0.dll

api-ms-win-crt-heap-l1-1-0.dll

api-ms-win-crt-locale-l1-1-0.dll

api-ms-win-crt-math-l1-1-0.dll

api-ms-win-crt-multibyte-l1-1-0.dll

api-ms-win-crt-private-l1-1-0.dll

api-ms-win-crt-process-l1-1-0.dll

api-ms-win-crt-runtime-l1-1-0.dll

api-ms-win-crt-stdio-l1-1-0.dll

api-ms-win-crt-string-l1-1-0.dll

api-ms-win-crt-time-l1-1-0.dll

api-ms-win-crt-utility-l1-1-0.dll

api-ms-win-eventing-provider-l1-1-0.dll((KB3118401 does not contain this file)

ucrtbase.dll

The corresponding .dll file cannot be found in C:\window\system\ or C:\window\SysWOW64\. There are some individual .dll files available for download on the Internet, but none of them work after trying. The correct way is to download the corresponding update from micorsoft official website and then install it. After reboot OK.

KB2999226, KB3118401 update download.

KB2999226 Microsoft download link https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows

KB3118401 Microsoft download link https://support.microsoft.com/en-us/help/3118401/update-for-universal-c-runtime-in-windows

Windows: Socket Server Failed to bind, error 10048 [How to Solve]

Address already in use.

Typically, only one usage of each socket address (protocol/IP address/port) is permitted.

This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that wasn’t closed properly, or one that is still in the process of closing.

For server applications that need to bind multiple sockets to the same port number, for example, the case where the client process is taskkilled and started again consider using setsockopt(SO_REUSEADDR).

Client applications usually need not call bind at all—connect chooses an unused port automatically. When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is committed. This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf.

BOOL bOptVal = TRUE;
        int bOptLen = sizeof(BOOL);
        iResult = setsockopt(ListenSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&bOptVal, bOptLen);
        if (iResult == SOCKET_ERROR)
        {
            char m[500];
            snprintf(m, 500, "%s %d: setsockopt failed, port %d failed with error: %d",
                __func__, __LINE__, port_number, WSAGetLastError());
            printf("%s\n", m);
            freeaddrinfo(result);
            closesocket(ListenSocket);
            WSACleanup();
            return -1;
        }

https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-setsockopt

Chromedriver executable needs to be in path [How to Solve]

Error when executing webdriver. Chrome(): Chrome driver executable needs to be in path

The reason may be that chrome driver is installed, or the chrome driver version does not match the chrome version

Step 1. Download chromedriver

View your own chrome version, and view the corresponding table of chrome driver to download

Download address: https://chromedriver.storage.googleapis.com/index.html

Step 2. Copy chromedriver.exe to the Chrome browser installation directory

After downloading the zip package, we found that there was only one chromedriver.exe file in it. Put the file under the installation directory of Chrome browser. For example, C: program files (x86), Google, chrome and application

(view chrome installation directory: open Chrome browser, open Task Manager, right-click chrome.exe, click properties to view the installation location)

Step 3. Copy chromedriver.exe to the python installation directory

Step 4. Add the browser environment variable to the system path

Turn on the computer – on the computer desktop – right click – my computer – select properties

In my computer properties – left – click – advanced system settings

Click environment variable find path Edit in system variable

OK! Try the python script under execution~