The difference between a cookie and a session
The difference between a cookie and a session:
1. The cookie data is stored on the client's browser and the session data is placed on the server.
2, the cookie is not very safe, others can analyze the cookie stored in the local and cookie deception
Consider that security should use the session.
3. Session will be saved on the server for a certain period of time. When access is increased, it will be more likely to occupy your server's performance
The cookie should be used in consideration of mitigating server performance.
4, a single cookie can not save more than 4K of data, many browsers restrict a site to save up to 20 cookies.
5, so personal advice:
Storing important information such as login information as session
Additional information can be placed in a cookie if it needs to be retained
What's the use of indexes? How do I build an index?
How SQL creates indexes and how to create indexes
The role of SQL to create indexes
First, the advantages of using the index:
1, unique index to ensure the uniqueness of the data 2, speed up the retrieval of data 3, speed up the connection between tables 4, reduce grouping and sorting time
5. Improve system performance by using the optimized stealth device
Second, the principle of using the index:
1. CREATE index 2 on columns that need to be searched frequently, create index on primary key
3. Create indexes on columns that are often used for connections
4. Create an index on a column that often needs to be searched based on the scope 5, the column that often needs to be sorted
6. Create an index on a column that is often used in a WHERE clause
Third, the principle of not creating indexes:
1. Queries rarely used and referenced columns are not indexed 2, columns with only a few values are not indexed
3. Columns defined as text, image, bit are not indexed
4. Indexes should not be built when update performance is much higher than select performance
Four, the commonly used commands:
1. Sp_helpindex: Index information on a report table or view
2. DBCC SHOWCONTIG: Displays fragmentation information for data and indexes for the specified table 3, DBCC DBREINDEX: rebuilding one or more indexes in the specified database
4. DBCC INDEXDEFRAG: Defragment a clustered index or secondary index that specifies a table or view
Five, optimize the index:
1. Rebuild index (DBCC DBREINDEX) 2, Index Tuning Wizard
3. Defragment the clustered index and secondary index fragmentation for the specified table or view (DBCC INDEXEFRAG)
How to create an index
The CREATE INDEX statement is used for creating indexes in the table.
Indexes enable database applications to find data faster without reading the entire table. Index
You can create indexes in a table to query data more quickly and efficiently.
How is ArrayList implemented, the difference between ArrayList and linedlist? ArrayList how to achieve capacity expansion.
The Equals method implements
Object oriented
Thread state, what's the difference between blocked and waiting
Watting is a thread called object.wait () that is waiting for another thread to call Object.notify () or Object.notifyall () on the object.
Blocked refers to a thread waiting to acquire a lock.
Summary: BLOCKED and waiting are non-active thread states. The waiting thread is already allocated CPU time, but waits for the event to occur so that the CPU is released voluntarily until certain events are completed and notify () wake is called, that is, the
waitting thread does not want the CPU time itself now, but
The blocked thread is desired, but the blocked thread does not get the lock, so the blocked thread is not available
. Luo Zhiyong Link: https://www.zhihu.com/question/27654579/answer/97448656 Source: Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
How the JVM loads bytecode files
JVM GC,GC algorithm.
What happens when the full GC is present, and what happens to the Yong GC.
JVM Memory model
Java Runtime Data area
How transactions are implemented
Get and post requests differ by GET request
GET /books/?sex=man&name=Professional HTTP/1.1Host: www.wrox.comUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)Gecko/20050225 Firefox/1.0.1Connection: Keep-Alive
Note that the last line is a blank line
POST request
POST / HTTP/1.1Host: www.wrox.comUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)Gecko/20050225 Firefox/1.0.1Content-Type: application/x-www-form-urlencodedContent-Length: 40Connection: Keep-Alivename=Professional%20Ajax&publisher=Wiley
1, get commits, the requested data will be appended to the URL (that is, the data placed in the HTTP protocol header), to split the URL and transfer data, multiple parameters with & connection; for example: login.action?name=hyddd&password= Idontknow&verify=%e4%bd%a0%E5%A5%BD. If the data is an English letter/number, sent as is, if it is a space, converted to +, if it is Chinese/other characters, the string is directly encrypted with BASE64, such as:%E4%BD%A0%E5%A5%BD, where the xx in%xx is the symbol in 16 binary notation ASCII.
Post submission: Place the submitted data in the package of the HTTP packet. In the example above, the red font indicates the actual transfer data
As a result, the data submitted by get is displayed in the Address bar, while the post is submitted, the address bar does not change
2, the size of the transmitted data: first of all: the HTTP protocol does not restrict the size of the transmitted data, the HTTP protocol specification does not limit the length of the URL.
The main limitations in the actual development are:
GET: Specific browsers and servers have restrictions on URL length, such as IE's limit on URL length is 2083 bytes (2k+35). For other browsers, such as Netscape, Firefox, etc., there is theoretically no length limit, and its limitations depend on the support of the operating system.
Therefore, for a get commit, the transmitted data is limited by the URL length.
POST: The theoretical data is not limited because it is not transmitted via a URL. However, the actual Web server will be required to limit the size of the post submission data, Apache, IIS6 have their own configuration.
3. Security
The security of post is higher than the security of get. For example: Through get submit data, user name and password will appear in plaintext on the URL, because (1) the login page may be cached by the browser, (2) Other people to view the browser's history, then others can get your account number and password, in addition, Using get to submit data may also cause Cross-site request forgery attack
4. The HTTP GET,POST,SOAP protocol is all running on HTTP
(1) Get: The request parameter is appended to the URL as a sequence of key/value pairs (query string)
The length of the query string is limited by the Web browser and Web server (ie supports up to 2048 characters) and is not suitable for transporting large datasets at the same time, it is unsafe
(2) Post: The request parameter is transmitted in a different part of the HTTP header (named entity body), which is used to transfer the form information, so the Content-type must be set to: application/x-www-form- Urlencoded. The post is designed to support user fields on Web Forms, and its parameters are also transmitted as key/value.
However: it does not support complex data types, because post does not define the semantics and rules for transferring data structures.
(3) Soap: is a dedicated version of HTTP POST, followed by a special XML message format
Content-type is set to: Text/xml Any data can be XML.
The HTTP protocol defines a number of ways to interact with the server, the most basic of which are 4, get,post,put,delete, respectively. A URL address is used to describe a resource on a network, and the Get, POST, PUT, delete in HTTP corresponds to the search for this resource, change, increase, delete 4 operations. Our most common is get and post. Get is typically used to get/query resource information, and post is typically used to update resource information.
Let's look at the difference between get and post
Get submitted data is placed after the URL, to split the URL and transfer data, the parameters are connected with &, such as editposts.aspx?name=test1&id=123456. The Post method is to put the submitted data in the body of the HTTP packet.
The data size for get commits is limited (because the browser has a limit on the length of the URL), and there is no limit to the data submitted by the Post method.
The Get method needs to use Request.QueryString to get the value of the variable, and the Post method takes the value of the variable by Request.Form.
The Get method submits the data, which brings security problems, such as a login page, when the data is submitted via get, the user name and password will appear on the URL, and if the page can be cached or someone else can access the machine, the user's account and password can be obtained from the history record.