When starting to use the Baidu Maps API for development, you may encounter quite a strange thing. Using Baidu's latitude and longitude to locate on the map is quite inaccurate. This problem was encountered during the development of WeChat and Android.The first time using the Baidu map api to get the location and display it on the map is when the WeChat development, it is not knowing the specific reason but can't get an offset in the WeChat acquisition location to calibrate, although it can barely solve, but Not quite accurate.Later on at the beginning of Android also encountered this problem, only to find Baidu map API positioning offset is not an accidental problem. Baidu map API positioning offset reason The following is from the internet: First, the coordinate system First of all, we have to understand what coordinate systems developers can access? The first classification: 1, GPS, WGS-84, the original coordinate system.The coordinates recorded by an international standard GPS recorder are all GPS coordinates.Unfortunately, in China, GPS coordinates are not allowed on any of the map products. It is said to be confidential.The GPS coordinates are shown in the form of latitude and longitude in latitude and longitude: 2,
Code obfuscation What is code confusion Java is a cross-platform, interpreted language in which Java source code is compiled into an intermediate "bytecode" stored in a class file.Due to cross-platform requirements, Java bytecode includes a lot of source code information, such as variable names, method names, and access to variables and methods through these names. These symbols carry a lot of semantic information and can be easily decompiled to Java. Source code.To prevent this, we can use the Java obfuscator to confuse Java bytecode. Obfuscation is to reorganize and process the released program, so that the processed code and the pre-processing code accomplish the same function, and the obfuscated code is difficult to be decompiled. Even if the decompilation is successful, it is difficult to obtain the true semantics of the program. .The confusing program code still complies with the original file format and instruction set. The execution result is also the same as before, but the obfuscator changes the names of all the variables, functions, and classes in the code to short English letter codes. With the corresponding function names and program comments, it will be difficult to read even if it is decompiled.At the same time, confusion is
NDK (android native develop kits): android local development kits, you can put c/c++ -> compile into a binary file that can be executed under Linux. The java code can be used to execute binary files through jni. What is JNI: java local development interface, JNI is a protocol This protocol is used to communicate java code and external native code (c/c++). Through this protocol, java code can call external c/c++, code outside c The /c++ code can also call java code. Java can achieve the development of the upper application, but can not write the underlying driver, some android projects must deal with the underlying hardware, such as to accurately and quickly obtain the value of a sensor, then java can not be done, then what to do, through JNI Development, complete the underlying driver or worth it via c/c++, then pass the value back to the java layer.The same java layer can also pass data to the c/c++ layer, so that data interaction is done through the JNI. Why use NDK? In summary, it is mainly divided into the following situations: 1. Code protection, because the java layer code of apk is easily decompiled, and C/C++ library is relatively
The backtracking method traverses the solution space tree through a depth-first traversal strategy. Its implementation process is to search for all its child or child nodes from the root node, and determine for each node whether it satisfies the constraint conditions and the decision function if it is satisfied. Entering this node also searches this node for its children.The node that owns a child node is called a live node. When no node is found in the search, the original parent node is returned to continue to search for a live node, and so on until the backtracking algorithm searches for the solution space tree. Backtracking is a omnipotent algorithm for solving problems because it traverses through all the possible solutions to the problem. If you construct the space tree correctly, you can traverse through the solution space tree.The backtracking algorithm can solve all possible solutions to the problem. When we actually solve some optimal solution problems, we can cut off the subtree that is worse than the intermediate solution by the pruning function. The minimum solution of m for the m-coloring problem of undirected graphs
(1) Run as command: DOS>scanHost start_ip end_ip (2) Output: Active host IP address. Implementation principle: (1) An ICMP_ECHO request message is sent through an IP address, and an ICMP_response message is received, indicating that the IP host is active. (2) Using raw sockets (3) In order to improve the detection time, multi-thread technology is used.
C + + scan specified host open port, OS provides a connect () system call, used to establish a connection with a remote host port, if the port is in the frame listening state of the remote host, connect () connection is successful; otherwise, the port is closed.
In network communication, the application program of the source host knows the IP address and port number of the destination host, but does not know the hardware address of the destination host, and the data packet is first received by the network card and then processed by the upper layer protocol, if the received data If the hardware address of the packet does not match the local machine, it will be discarded.Therefore, the destination host hardware address must be obtained before communication.The ARP protocol plays this role.The source host sends an ARP request and asks “the hardware address of the host whose IP address is 192.168.0.1” and broadcasts this request to the local network segment (The hardware address of the Ethernet frame header is FF:FF:FF:FF:FF :FF indicates broadcast. When the destination host receives the broadcast ARP request and finds that the IP address matches the local machine, it sends an ARP reply packet to the source host and fills in its own hardware address in the reply packet. Each host maintains an ARP cache table, which can be viewed using the arp -a command.The entries in the cache table have an expiration time (generally 20 minutes). If no entry is
problem Given an arbitrary undirected graph, the graph is divided into several subsets. Any two nodes in the subset set are not connected. The greedy algorithm is used to minimize the number of subsets. Algorithm steps or processes: Construct a vector A to join by the size of the node. Build vector B is empty, B stores the final result, its elements are subsets Take the first element m of the vector A (that is, the largest degree) and add it to the vector B, and iterate over the elements in B. If m is not connected to the elements in the element (subset) of B, then join the current subset if it is connected. Create a new subset. Remove m in vector A and reorder vector A according to size, repeat 3 C++ code
Regional Controller Serial Protocol 1. Communication format = [frame header] + [data length] + [instruction code] + [communication content] + [checksum] + [end of frame]. 2. The data length is the total number of bytes (including frame headers and frame trailers) from the beginning of the frame to the end of the frame. 3. The checksum is the exclusive OR of all the bytes in front of the check bits. 4. RS232 serial port communication, Porter Rate 9600, no parity, 8 data bits, 1 stop bit. 5, multi-byte data transmission, high in the front, low in the post Key code port.cpp