Category Archives: How to Fix

Exponentiation in shell

Today, Xiaobai suddenly wanted to use the shell to find the 32 power of 2, but couldn’t find a solution. After searching on the Internet, I found it was very simple, as follows:
oracle@linux101:~> Echo “2**32” | bc-l # thus it can be obtained that BC does not support the power solution
(standard_in) 1: syntax error
Method 1:
oracle@linux101:~> let “2**32”
oracle@linux101:~> let “y=2**32”
oracle@linux101:~> echo $y
4294967296
Method 2:
oracle@linux101:~> echo $[2**32]
4294967296
 
1. Summarize the operator in the shell:
+ : add two variables.
– : subtract two variables.
* : multiply two variables.
/: divide two variables.
** : power two variables.
% : modulus operation, the first variable divided by the second variable to find the remainder.
+= : plus equals, add a second variable on top of itself.
-= : minus is equal to, subtract the second variable from the first variable.
*= : multiply by equals, multiplying by the second variable from the first.
/= : division is equal to, on the basis of the first variable divided by the second variable.
%= : take module assignment, the first variable takes module operation on the second variable, and then assigns value to the first variable.
2. Common operation commands:
A. Use lets to indicate mathematical operations. You can first assign the result of the operation to the variable B. The operation command is B =let 1 + 2. Echo $b is then used to output the value of B. If there is no let, it outputs 1+2.
B. Use $[] to express the mathematical operation. Writes a mathematical operation to the $[] bracket, and the contents of the bracket are mathematically performed first. For example, the command echo $[1+2] will output the result 3.
C. Use EXPR to change the order of operations. Echo ‘expr 1+2’ can be used to output the result of 1+2, using expr to represent the following expression as a mathematical operation. Note that ‘is not a single quotation mark, but the symbol above the “Tab” key.
d. BC for mathematical operations. You can use it in conjunction with the echo command, for example: echo “3.21*2” | BC to calculate the 3.21*2 floating-point operation
E. Use AWK for mathematical commands. Echo 2 | awk ‘{print $1**32}’

Error 1606 could not access network location% SystemDrive% / inetpub / wwwroot /

Prompt for title error when uninstalling or reinstalling Infragistics NetAdvantage
Under Windows 7
1. Open registry Regedit
2, find the HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/InetStp PathWWWRoot
64-bit operating system: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\InetStp\PathWWWRoot
% SystemDrive %/inetpub/below/= = “C: \ inetpub \ below
 

 
 
 
 

[xampp] error: Apache shutdown unexpected. 11:00:50 [Apache] solution details

XAMPP Apache does not work, and has been reporting errors:
Error: Apache shutdown unexpectedly. 11:00:50 [Apache] This may be due to a blocked port, missing dependencies, 11:00:50 (Apache) improper privileges, a crash, Or a shutdown by another method. 11:00:50 [Apache] Press the Logs button to view error
 
That means the port problem, just change the port.
 

    click on this Config and select the Service and Port Settings

 

 
2. Change the original port Numbers 80 and 443 to 8080 and 4433, respectively (more commonly used, can also be changed to other unused ports, such as 81,801)

 
3. Then click Config in the main interface, select httpd.conf and httpd-sSL. conf to find the corresponding positions respectively and change them to 8080 and 4433 set previously (if other port Numbers are set, change the corresponding Settings).

 
This position is very easy to find, and when you see the number of Listen, you only need to change the Listen below. If this doesn’t work, change the Listen above


 
5. The next detail is that you have to go to the status bar to turn Xampp off completely! Reopen it. If it still doesn’t work, try again with a different port number.
 

 
Leave a comment.

Python TCP socket programming: send returns broken pipe error?

One of the most common mistakes in socket programming is the ECONNRESET error that I mentioned in this article. Another mistake that is rarely encountered is the EPIPE error that I will talk about today. This error can occur when sending data when the send function is called, and the program throws the following exception:

socket.error: [Errno 32] Broken pipe

Why this error?First, take a look at the official man 2 write document describing this error:

EPIPE
fd is connected to a pipe or socket whose reading end is closed. When this happens the writing process will also receive a SIGPIPE signal. (Thus, the write return value is seen only if the program catches, blocks or ignores this signal.)

Above, when writing data to a closed reader pipe or socket, the program receives a SIGPIPE signal. We have seen the example of a pipeline in this article.
Today, we’ll take a simple socket example to explore why this error occurs.
The client code is as follows:

import socket
import time

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', 2222))

s.send('hello')
time.sleep(1)
s.send('hello')
s.send('hello')

s.close()

The server code is as follows:

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('127.0.0.1', 2222))
s.listen(5)

c, addr = s.accept()

c.recv(1024)

c.close()

After 1 second of running the client program, the Broken pipe error occurs:

[root@localhost python]# python client.py 
Traceback (most recent call last):
  File "client.py", line 10, in <module>
    s.send('hello')
socket.error: [Errno 32] Broken pipe

The results are as follows:

03:51:51.137047 IP 127.0.0.1.50870 > 127.0.0.1.2222: Flags [S], seq 2737957170, win 32792, options [mss 16396,sackOK,TS val 39403123 ecr 0,nop,wscale 5], length 0
03:51:51.137055 IP 127.0.0.1.2222 > 127.0.0.1.50870: Flags [S.], seq 2751472309, ack 2737957171, win 32768, options [mss 16396,sackOK,TS val 39403123 ecr 39403123,nop,wscale 5], length 0
03:51:51.137061 IP 127.0.0.1.50870 > 127.0.0.1.2222: Flags [.], ack 1, win 1025, options [nop,nop,TS val 39403123 ecr 39403123], length 0
03:51:51.137083 IP 127.0.0.1.50870 > 127.0.0.1.2222: Flags [P.], seq 1:6, ack 1, win 1025, options [nop,nop,TS val 39403123 ecr 39403123], length 5
03:51:51.137089 IP 127.0.0.1.2222 > 127.0.0.1.50870: Flags [.], ack 6, win 1024, options [nop,nop,TS val 39403123 ecr 39403123], length 0
03:51:51.137158 IP 127.0.0.1.2222 > 127.0.0.1.50870: Flags [F.], seq 1, ack 6, win 1024, options [nop,nop,TS val 39403123 ecr 39403123], length 0
03:51:51.139348 IP 127.0.0.1.50870 > 127.0.0.1.2222: Flags [.], ack 2, win 1025, options [nop,nop,TS val 39403137 ecr 39403123], length 0
03:51:52.140421 IP 127.0.0.1.50870 > 127.0.0.1.2222: Flags [P.], seq 6:11, ack 2, win 1025, options [nop,nop,TS val 39404140 ecr 39403123], length 5
03:51:52.140444 IP 127.0.0.1.2222 > 127.0.0.1.50870: Flags [R], seq 2751472311, win 0, length 0

It was observed that the error occurred as follows:

    client during sleep, the server has closed the connection normally. After the client is awakened, the first call to send to send data causes the socket to receive RST message. The second call send and then send the data causes the program to receive the SIGPIPE signal, and the Broken pipe error occurs.

Therefore, we can draw the conclusion that if the opposite end closes the connection normally and then RST message is received on the socket, then when send is called on the socket, the Broken pipe error will occur!
This error is usually caused by a bug in the program code, but it is not a serious error and can usually be avoided by ignoring the SIGPIPE signal.

Disk error press any key to restart solution

Question: 1. Boot display: Disk Error press any key to Restart. Can not enter the system, but after pressing any key, or appear this sentence!
2. After starting up, the cursor has been flashing, just can’t get into the system!
Solution: 1. First of all, in the case of computer restart, be sure to pull out the U disk, such as mobile hard disk, otherwise the above problems will appear!
2. There’s something really wrong with your hard drive. It’s time to fix it.
 

python: HTTP Error 505: HTTP Version Not Supported

The urlliB2 module of Python is used to obtain the data code as follows:

Try:
    data = urllib2.urlopen(url).read()
except Exception,e:
    print e
return data

Url parameter is:

http://sms.gildata.com:8080/sms/sendSms.do?content=Hello world&msisdns=18373239087&user=gildata2&key=804

The following problems occurred while executing the code:
HTTP Error 505: the HTTP Version Not Supported
online are urllib2 module does Not support http1.1 agreement, must carry on the processing of one sort or another, but I later found out that seems to be the url does Not support Spaces, I will Hello world this parameter Spaces take out, can successfully send text messages to come out, if it is in space can be used to add escape character % 20 instead of Spaces, you can also use % 0 a instead of a newline.

VirtualBox for macOS NS_ ERROR_ Failure (0x80004005) problem solving record

System environment
macOS catalina(10.15)virtualbox version: 6.0.14 r133895
Problem description
After upgrading the old version of VirtualBox 5 to VirtualBox 6.0, the following error is found in docker-machine start

➜  ~ docker-machine start
Starting "default"...
(default) Check network to re-create if needed...
Unable to start the VM: /usr/local/bin/VBoxManage startvm default --type headless failed:
VBoxManage: error: The virtual machine 'default' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

Details: 00:29:32.593106 Console: Machine state changed to 'PoweredOff'


found that all Vbox virtual machines could not start, the reason should be the same
. Then I remembered that I once had the permission to change some system directory (or users), whether I changed the installation path of VirtualBox
solution

    because I’m not sure the original /Application/VirtualBox. App what permissions, so the uninstall tools perform VirtualBox installation image will be installed version completely uninstall, and then reassembled, found after heavy users and user groups is root: admin , but start still have the same error for help online, watch some, not installed corresponding enhanced version of the tools expansion pack, So I went to the official website to download the enhancement package and install it. When installing the package, an error was reported: then found that although The error type was The same, this time it was reported for a different reason: VBoxExtPackHelperApp: error: The owner is not root: /Applications. Now I remember that I once changed The /Application directory to a normal user in order to test a certain program and forgot to change it back... Really dug a pit pit themselves so /Applications by users and groups in the root: wheel , to perform the installation of the expansion pack, installation is not an error, guess is probably because when the user is not the root cause in the installation directory belong to unable to perform a specific system commands (such as virtual machine driver installation ) expansion pack, after the success of the installation, open the virtual machine again, found that already can start, The problem has been fixed here.

summary

    do not eat too full to have nothing to modify the system directory permissions (including the users) encounter problems can be Internet help, and then for each possible useful scheme to try one by one

Ubuntu (16.04) creates a Windows boot U disk, using woeusb instead of DD

Ubuntu (16.04) creates Windows boot usb drives, using WOeUSB instead of DD
Dd creation often doesn’t start, I heard that you have to convert isohybrid to get to the USB flash drive. (Also, for Linux clones, if you already have a Linux system, install a Squashfs-Tools, just copy the root unsquashfs from the CD to a partition, and change the password to Chroot.)
Then we have to use another tool: WoeUSB
Installation:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update 
sudo apt install woeusb

graphical interface use is not talked about, talked about the command line:

sudo woeusb --device </path/to/windows.iso> <device>
for example
sudo woeusb --device /home/windows.iso /dev/sdc

Update: if you get an error like this: “Error: Partition(s) on /dev/sdb are being used” when WinUSB/WoeUSB tries to format the USB stick from the command line, or “Error 256” in the beginning of the process when using the GUI, you must unmount the partitions. Firstly, to get a list of partitions, run the following command (“mount” also works):

df -aTh

This should list all the partitions mounted on your system. If you got here, you should already know the USB device drive, e.g. /dev/sdc, so you need to look for the partitions (it could also only be one) on this drive, like /dev/sdc1, /dev/sdc2, etc. Then, unmount them like this (example):

sudo umount /dev/sdc1
sudo umount /dev/sdc2
(etc)

HALCON error #2036: could not find license file in operator set_ Part solution

HALCON error #2036: could not find license file in operator set_part
operator set_part
copy the license folder into the root directory of exe, then you can run the program normally



2019-03-04
change the license_xxx.dat to license.dat and put it in the root directory of the running program to solve the license_xxx.dat. Please note that the license_xxx.dat must be valid and have no expired certificates

node.js Error: write epipe problem solved!

1. Open the Gulpfile.js file in the installation directory
2, as shown in the figure below, the error place annotation or default in the operation will be deleted accordingly. If you need to use the annotation, please download the lower version and try to install the slave again


3. Error report is shown in the figure below