Binary Search Conclusion
Mr. Knuth, who invents KMP algorithm, once has said that the idea of binary search is straight forward, but devil in the details.
IP command
Cent OS/RHEL 5 or 6 = ifconfig
CentOS/RHEL 7 = ip
CentPS/RHEL 7.5 and up = ifconfig command has been deprecated, you should type: ip addr
To use ifconfig in 7.5 = yum install net-tools
1 | echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 1.7)" >> ~/.bash_profile |
TCP is a transport layer protocol provides connection-oriented, reliable service to applications. It supports unicast only. TCP connection uses socket: the combination of an IP address and a port number which is uniquely identified by the two end sockets. TCP connection establishment: two end TCP modules allocate required resources for the connection and negotiate the value of the parameter uses such as maximum segment size(MSS), given by the receiver side, and receiving buffer size(advertised window, WIN). Initial sequence number(ISN), specified by the sender side.
Create a list contains number from 2 to n.
Initially, set p to 2 which is the first prime number.
Starting from p^2, mark p*(p+1), p*(p+2), p*(p+3)… as not prime numbers
Find the smallest number greater than p that is not marked in the list, and repeat from step 3. If there is no such number, stop.
Time Complexity: O(nlog(log(n)))
Naming a property starting with a single underscore implies that the property is protected and is not recommended for direct access, so if you want to access the property, you can do so using the getter and setter methods of the property. To do this, consider using the @property wrapper to wrap getter and setter methods to make access to properties secure and convenient, as shown below.
if "__name__" == "__main__":
If the module we import, in addition to defined functions, still has executable code. Then python interpreter would execute this code which is unexpected. Therefore, if we write executable code in modules, better put this code in if "__name__" == "__main__":
so that the code under “if” condition won’t be executed unless to execute its module directly. Since only the name of the module to be executed directly is "__main__"
.