HTTP Protocol Brief

1. Use Google / Analysis of the browser of foxes

stay Web Application , The server sends the web page to the browser , In fact, it's the web page HTML Code sent to browser , Let the browser show . And the transport protocol between browser and server is HTTP, therefore :

  • HTML Is a text used to define a web page , Meeting HTML, You can write web pages ;

  • HTTP It's on the network HTML The agreement , For browser and server communication .

Chrome The browser provides a complete set of debugging tools , Very suitable Web Development .

Install well Chrome Behind the browser , open Chrome, Select in menu “ View ”,“ developer ”,“ Developer tools ”, You can display developer tools :

explain

  • Elements Show the structure of the web page
  • Network Show communication between browser and server

Let's order Network, Make sure the first little red light is on ,Chrome All communications between the browser and the server are recorded :

2. http Analysis of the agreement

When we type in the address bar www.sina.com when , The browser will display Sina's home page . In the process , What do browsers do ? adopt Network The record of , We can know . stay Network in , find www.sina.com That record , Click on , The right side will show Request Headers, Click on the right view source, We can see the request from the browser to Sina server :

2.1 Browser request

explain

The first two lines of analysis are as follows , first line :

 GET / HTTP/1.1

GET Represents a read request , Will get web data from the server ,/ Express URL The path of ,URL Always with / start ,/ It means home page , final HTTP/1.1 Indicate the use of HTTP Agreement version is 1.1. at present HTTP The version of the agreement is 1.1, But most servers also support 1.0 edition , The main difference is that 1.1 Multiple versions are allowed HTTP Request to reuse one TCP Connect , To speed up transmission .

Start with the second line , Each line is similar to Xxx: abcdefg:

 Host: www.sina.com

Indicates that the requested domain name is www.sina.com. If a server has more than one website , The server needs to go through Host To distinguish which website the browser requests .

2.2 Server response

Keep going down and find Response Headers, Click on view source, Displays the original response data returned by the server :

HTTP The response is divided into Header and Body Two parts (Body Optional. ), We are Network See in the Header The most important lines are as follows :

HTTP/1.1 200 OK

200 Indicates a successful response , hinder OK Yes description .

If not 200, So there are often other functions , for example

  • The failed responses are 404 Not Found: The web page doesn't exist
  • 500 Internal Server Error: There was an internal error in the server

... wait ...

 Content-Type: text/html

Content-Type Indicates the content of the response , Here is text/html Express HTML Webpage .

Please note that , Browsers rely on Content-Type To determine whether the content of the response is a web page or a picture , Video or music . Browsers don't rely on URL To determine the content of the response , therefore , Even if URL yes http://www.baidu.com/meimei.jpg, It doesn't have to be a picture .

HTTP Responsive Body Namely HTML Source code , Let's choose... From the menu bar “ View ”,“ developer ”,“ View source code of webpage ” You can view it directly in the browser HTML Source code :

Browser parsing process

When the browser reads the HTML After the source , It will parse HTML, Display page , then , according to HTML All kinds of links in it , Send again HTTP Request to Sina server , Get the pictures 、 video 、Flash、JavaScript Script 、CSS And so on , Finally, a complete page is displayed . So we are Network You can see a lot of extra HTTP request .

3. summary

3.1 HTTP request

Tracking Sina's home page , Let's summarize HTTP Requested process :

3.1.1 step 1: The browser first sends... To the server HTTP request , The request includes :

Method :GET still POST,GET Just request resources ,POST It comes with user data ;

route :/full/url/path;

domain name : from Host Header assignment :Host: www.sina.com

And so on Header;

If it is POST, So the request also includes a Body, Contains user data

3.1.1 step 2: The server returns to the browser HTTP Respond to , Responses include :

Response code :200 It means success ,3xx Indicates redirection ,4xx Indicates that there is an error in the request sent by the client ,5xx Indicates that an error occurred during server-side processing ;

Response type : from Content-Type Appoint ;

And so on Header;

Usually the server's HTTP The response carries the content , That is, there is a Body, Contains the content of the response , Web page HTML The source code is Body in .

3.1.1 step 3: If the browser needs to continue to request other resources from the server , Such as the picture , Just send it out again HTTP request , Repeat step 1、2.

Web Adopted HTTP The protocol uses a very simple request - Response patterns , This greatly simplifies the development of . When we write a page , All we need to do is HTTP In the request HTML Send out , No need to think about how to attach pictures 、 Video etc. , If the browser needs to request pictures and videos , It will send another one HTTP request , therefore , One HTTP The request processes only one resource ( In this case, it can be understood as TCP Short connection in protocol , Get only one resource per link , If you need more than one, you need to create multiple links )

HTTP The protocol also has strong scalability , Although the browser requested http://www.sina.com Home page , But Sina is HTML Resources of other servers can be chained in , such as <img src="http://i1.sinaimg.cn/home/2013/1008/U8455P30DT20131008135420.png">, Thus, the pressure of requests is distributed to various servers , also , One site can link to other sites , Countless sites are linked to each other , Formed World Wide Web, abbreviation WWW.

3.2 HTTP Format

Every HTTP The request and response follow the same format , One HTTP contain Header and Body Two parts , among Body It's optional .

HTTP Protocol is a text protocol , therefore , Its format is also very simple .

3.2.1 HTTP GET Format of request :

 GET /path HTTP/1.1
Header1: Value1
Header2: Value2
Header3: Value3

Every Header A line of one , Line breaks are \r\n.

3.2.2 HTTP POST Format of request :

 POST /path HTTP/1.1
Header1: Value1
Header2: Value2
Header3: Value3 body data goes here...

When two in a row \r\n when ,Header Partial end , All the data in the back are Body.

3.2.3 HTTP Format of response :

 200 OK
Header1: Value1
Header2: Value2
Header3: Value3 body data goes here...

HTTP If the response contains body, through \r\n\r\n To separate .

Please pay attention to ,Body The data type of is determined by Content-Type Head to make sure , If it's a web page ,Body It's text , If it's a picture ,Body It's the binary data of the picture .

When it exists Content-Encoding when ,Body Data is compressed , The most common compression method is gzip, therefore , notice Content-Encoding: gzip when , Need to put Body Decompress the data first , To get the real data . The purpose of compression is to reduce Body Size , Speed up network transmission .

Web Static servers -1- Display a fixed page

#coding=utf-8
import socket
from multiprocessing import Process def handleClient(clientSocket):
' With a new process , Serve a client '
recvData = clientSocket.recv(2014)
requestHeaderLines = recvData.splitlines()
for line in requestHeaderLines:
print(line) responseHeaderLines = "HTTP/1.1 200 OK\r\n"
responseHeaderLines += "\r\n"
responseBody = "hello world" response = responseHeaderLines + responseBody
clientSocket.send(response)
clientSocket.close() def main():
' As the main control entry of the program ' serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serverSocket.bind(("", 7788))
serverSocket.listen(10)
while True:
clientSocket,clientAddr = serverSocket.accept()
clientP = Process(target = handleClient, args = (clientSocket,))
clientP.start()
clientSocket.close() if __name__ == '__main__':
main()

Server side

client

Web Static servers -2- Display the desired page

#coding=utf-8
import socket
from multiprocessing import Process
import re def handleClient(clientSocket):
' With a new process , Serve a client '
recvData = clientSocket.recv(2014)
requestHeaderLines = recvData.splitlines()
for line in requestHeaderLines:
print(line) httpRequestMethodLine = requestHeaderLines[0]
getFileName = re.match("[^/]+(/[^ ]*)", httpRequestMethodLine).group(1)
print("file name is ===>%s"%getFileName) #for test if getFileName == '/':
getFileName = documentRoot + "/index.html"
else:
getFileName = documentRoot + getFileName print("file name is ===2>%s"%getFileName) #for test try:
f = open(getFileName)
except IOError:
responseHeaderLines = "HTTP/1.1 404 not found\r\n"
responseHeaderLines += "\r\n"
responseBody = "====sorry ,file not found===="
else:
responseHeaderLines = "HTTP/1.1 200 OK\r\n"
responseHeaderLines += "\r\n"
responseBody = f.read()
f.close()
finally:
response = responseHeaderLines + responseBody
clientSocket.send(response)
clientSocket.close() def main():
' As the main control entry of the program ' serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serverSocket.bind(("", 7788))
serverSocket.listen(10)
while True:
clientSocket,clientAddr = serverSocket.accept()
clientP = Process(target = handleClient, args = (clientSocket,))
clientP.start()
clientSocket.close() # The server is configured here
documentRoot = './html' if __name__ == '__main__':
main()

Server side

client

Web Static servers -3- Use class

#coding=utf-8
import socket
import sys
from multiprocessing import Process
import re class WSGIServer(object): addressFamily = socket.AF_INET
socketType = socket.SOCK_STREAM
requestQueueSize = 5 def __init__(self, server_address):
# Create a tcp Socket
self.listenSocket = socket.socket(self.addressFamily,self.socketType)
# Allows reuse of the last socket bound port
self.listenSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# binding
self.listenSocket.bind(server_address)
# Become passive , And make the length of the queue
self.listenSocket.listen(self.requestQueueSize) def serveForever(self):
' Cycling web The server , Wait for the client's link and serve the client '
while True:
# Wait for the new client to arrive
self.clientSocket, client_address = self.listenSocket.accept() # Method 2, Multiprocess server , Concurrent servers on multiple clients
newClientProcess = Process(target = self.handleRequest)
newClientProcess.start() # Because the creation of a new process , Will be on this socket +1, So you need to subtract the sequence from the main process , Call once close
self.clientSocket.close() def handleRequest(self):
' With a new process , Serve a client '
recvData = self.clientSocket.recv(2014)
requestHeaderLines = recvData.splitlines()
for line in requestHeaderLines:
print(line) httpRequestMethodLine = requestHeaderLines[0]
getFileName = re.match("[^/]+(/[^ ]*)", httpRequestMethodLine).group(1)
print("file name is ===>%s"%getFileName) #for test if getFileName == '/':
getFileName = documentRoot + "/index.html"
else:
getFileName = documentRoot + getFileName print("file name is ===2>%s"%getFileName) #for test try:
f = open(getFileName)
except IOError:
responseHeaderLines = "HTTP/1.1 404 not found\r\n"
responseHeaderLines += "\r\n"
responseBody = "====sorry ,file not found===="
else:
responseHeaderLines = "HTTP/1.1 200 OK\r\n"
responseHeaderLines += "\r\n"
responseBody = f.read()
f.close()
finally:
response = responseHeaderLines + responseBody
self.clientSocket.send(response)
self.clientSocket.close() # Set the port of the server
serverAddr = (HOST, PORT) = '', 8888
# Set the path when the server serves static resources
documentRoot = './html' def makeServer(serverAddr):
server = WSGIServer(serverAddr)
return server def main():
httpd = makeServer(serverAddr)
print('web Server: Serving HTTP on port %d ...\n'%PORT)
httpd.serveForever() if __name__ == '__main__':
main()v

Server dynamic resource request

1. Browser request dynamic page process

2. WSGI

How do you just build Web Run a Django application and Flask application , How to adapt to different situations without any changes web Architecture? ?

In the past , choice  Python web framework Will be subject to the availability of web The server , vice versa . If architecture and server can work together , That's all right. :

But it's possible to face ( Or had ) The following questions , When it comes to combining a server with an architecture , It turns out they're not designed to work together :

that , How can we ensure that we can run in multiple architectures without modifying the server and architecture code web What about servers? ? The answer is Python Web Server Gateway Interface ( Or abbreviation WSGI, pronounce as “wizgy”).

WSGI Allow developers to choose web The framework and web Server separation . Can mix and match web The server and web frame , Choose a suitable match . such as , Can be in Gunicorn perhaps Nginx/uWSGI perhaps Waitress Up operation Django, Flask, or Pyramid. Real hybrid matching , Thanks to the WSGI Support both server and Architecture :

web The server must have WSGI Interface , All the modern Python Web The framework is already in place WSGI Interface , It allows you to change the server and features without changing the code web The framework works together .

WSGI from web Server support , and web The framework allows you to choose the right match for yourself , But it also makes it easier for server and framework developers to focus on their preferred areas and expertise without getting caught up in each other . Other languages have similar interfaces :java Yes Servlet API,Ruby Yes Rack.

3. Definition WSGI Interface

WSGI Interface definition is very simple , It only requires Web The developer implements a function , I can respond HTTP request . Let's take a look at the simplest Web Version of “Hello World!”:

def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return 'Hello World!'

above application() The function is the one that fits WSGI One of the standards HTTP Processing function , It takes two parameters :

  • environ: One contains all HTTP Asking for information dict object ;
  • start_response: A send HTTP Function of response .

Whole application() The function itself doesn't involve any parsing HTTP Part of , in other words , Put the bottom layer web The server parsing part is separated from the application logic part , So developers can focus on one area

however , wait , This application() How to call a function ? If we call ourselves , Two parameters environ and start_response We can't provide , Back to str I can't send it to the browser .

therefore application() Function must be created by WSGI Server to call . There's a lot of conformity WSGI Canonical server . And what we're doing right now is web The purpose of the server project is to be a server that can parse static web pages and dynamic web pages

Web Dynamic server -1

#coding=utf-8
import socket
import sys
from multiprocessing import Process
import re class WSGIServer(object): addressFamily = socket.AF_INET
socketType = socket.SOCK_STREAM
requestQueueSize = 5 def __init__(self, serverAddress):
# Create a tcp Socket
self.listenSocket = socket.socket(self.addressFamily,self.socketType)
# Allows reuse of the last socket bound port
self.listenSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# binding
self.listenSocket.bind(serverAddress)
# Become passive , And make the length of the queue
self.listenSocket.listen(self.requestQueueSize) self.servrName = "localhost"
self.serverPort = serverAddress[1] def serveForever(self):
' Cycling web The server , Wait for the client's link and serve the client '
while True:
# Wait for the new client to arrive
self.clientSocket, client_address = self.listenSocket.accept() # Method 2, Multiprocess server , Concurrent servers on multiple clients
newClientProcess = Process(target = self.handleRequest)
newClientProcess.start() # Because the creation of a new process , Will be on this socket +1, So you need to subtract the sequence from the main process , Call once close
self.clientSocket.close() def setApp(self, application):
' Set this WSGI Application entry function called by the server '
self.application = application def handleRequest(self):
' With a new process , Serve a client '
self.recvData = self.clientSocket.recv(2014)
requestHeaderLines = self.recvData.splitlines()
for line in requestHeaderLines:
print(line) httpRequestMethodLine = requestHeaderLines[0]
getFileName = re.match("[^/]+(/[^ ]*)", httpRequestMethodLine).group(1)
print("file name is ===>%s"%getFileName) #for test if getFileName[-3:] != ".py": if getFileName == '/':
getFileName = documentRoot + "/index.html"
else:
getFileName = documentRoot + getFileName print("file name is ===2>%s"%getFileName) #for test try:
f = open(getFileName)
except IOError:
responseHeaderLines = "HTTP/1.1 404 not found\r\n"
responseHeaderLines += "\r\n"
responseBody = "====sorry ,file not found===="
else:
responseHeaderLines = "HTTP/1.1 200 OK\r\n"
responseHeaderLines += "\r\n"
responseBody = f.read()
f.close()
finally:
response = responseHeaderLines + responseBody
self.clientSocket.send(response)
self.clientSocket.close()
else: # Construct environment variable dictionary according to received request header
env = {} # Call the corresponding method of the application , Complete the acquisition of dynamic data
bodyContent = self.application(env, self.startResponse) # Organization data sent to client
self.finishResponse(bodyContent) def startResponse(self, status, response_headers):
serverHeaders = [
('Date', 'Tue, 31 Mar 2016 10:11:12 GMT'),
('Server', 'WSGIServer 0.2'),
]
self.headers_set = [status, response_headers + serverHeaders] def finishResponse(self, bodyContent):
try:
status, response_headers = self.headers_set
#response The first line of
response = 'HTTP/1.1 {status}\r\n'.format(status=status)
#response Other header information for
for header in response_headers:
response += '{0}: {1}\r\n'.format(*header)
# Add a newline , For and body To separate
response += '\r\n'
# Add data sent
for data in bodyContent:
response += data self.clientSocket.send(response)
finally:
self.clientSocket.close() # Set the port of the server
serverAddr = (HOST, PORT) = '', 8888
# Set the path of the server's static resources
documentRoot = './html'
# Set the path of server dynamic resources
pythonRoot = './wsgiPy' def makeServer(serverAddr, application):
server = WSGIServer(serverAddr)
server.setApp(application)
return server def main(): if len(sys.argv) < 2:
sys.exit(' Please follow the request , Specify module name : apply name , for example module:callable') # obtain module:callable
appPath = sys.argv[1]
# Cut according to the colon as module and callable
module, application = appPath.split(':')
# Add pathsets sys.path
sys.path.insert(0, pythonRoot)
# Dynamic import module Module specified in variable
module = __import__(module)
# obtain module Of the module specified in the variable ,application Variable specified properties
application = getattr(module, application)
httpd = makeServer(serverAddr, application)
print('WSGIServer: Serving HTTP on port %d ...\n'%PORT)
httpd.serveForever() if __name__ == '__main__':
main()

Application examples

import time
def app(environ, start_response):
status = '200 OK'
response_headers = [('Content-Type', 'text/plain')]
start_response(status, response_headers)
return [str(environ)+'==Hello world from a simple WSGI application!--->%s\n'%time.ctime()]

Web Dynamic server -2- Pass data to the application

#coding=utf-8
import socket
import sys
from multiprocessing import Process
import re class WSGIServer(object): addressFamily = socket.AF_INET
socketType = socket.SOCK_STREAM
requestQueueSize = 5 def __init__(self, serverAddress):
# Create a tcp Socket
self.listenSocket = socket.socket(self.addressFamily,self.socketType)
# Allows reuse of the last socket bound port
self.listenSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# binding
self.listenSocket.bind(serverAddress)
# Become passive , And make the length of the queue
self.listenSocket.listen(self.requestQueueSize) self.servrName = "localhost"
self.serverPort = serverAddress[1] def serveForever(self):
' Cycling web The server , Wait for the client's link and serve the client '
while True:
# Wait for the new client to arrive
self.clientSocket, client_address = self.listenSocket.accept() # Method 2, Multiprocess server , Concurrent servers on multiple clients
newClientProcess = Process(target = self.handleRequest)
newClientProcess.start() # Because the creation of a new process , Will be on this socket +1, So you need to subtract the sequence from the main process , Call once close
self.clientSocket.close() def setApp(self, application):
' Set this WSGI Application entry function called by the server '
self.application = application def handleRequest(self):
' With a new process , Serve a client '
self.recvData = self.clientSocket.recv(2014)
requestHeaderLines = self.recvData.splitlines()
for line in requestHeaderLines:
print(line) httpRequestMethodLine = requestHeaderLines[0]
getFileName = re.match("[^/]+(/[^ ]*)", httpRequestMethodLine).group(1)
print("file name is ===>%s"%getFileName) #for test if getFileName[-3:] != ".py": if getFileName == '/':
getFileName = documentRoot + "/index.html"
else:
getFileName = documentRoot + getFileName print("file name is ===2>%s"%getFileName) #for test try:
f = open(getFileName)
except IOError:
responseHeaderLines = "HTTP/1.1 404 not found\r\n"
responseHeaderLines += "\r\n"
responseBody = "====sorry ,file not found===="
else:
responseHeaderLines = "HTTP/1.1 200 OK\r\n"
responseHeaderLines += "\r\n"
responseBody = f.read()
f.close()
finally:
response = responseHeaderLines + responseBody
self.clientSocket.send(response)
self.clientSocket.close()
else:
# Process received request headers
self.parseRequest() # Construct environment variable dictionary according to received request header
env = self.getEnviron() # Call the corresponding method of the application , Complete the acquisition of dynamic data
bodyContent = self.application(env, self.startResponse) # Organization data sent to client
self.finishResponse(bodyContent) def parseRequest(self):
' Extract the request'
requestLine = self.recvData.splitlines()[0]
requestLine = requestLine.rstrip('\r\n')
self.requestMethod, self.path, self.requestVersion = requestLine.split(" ") def getEnviron(self):
env = {}
env['wsgi.version'] = (1, 0)
env['wsgi.input'] = self.recvData
env['REQUEST_METHOD'] = self.requestMethod # GET
env['PATH_INFO'] = self.path # /index.html
return env def startResponse(self, status, response_headers, exc_info=None):
serverHeaders = [
('Date', 'Tue, 31 Mar 2016 10:11:12 GMT'),
('Server', 'WSGIServer 0.2'),
]
self.headers_set = [status, response_headers + serverHeaders] def finishResponse(self, bodyContent):
try:
status, response_headers = self.headers_set
#response The first line of
response = 'HTTP/1.1 {status}\r\n'.format(status=status)
#response Other header information for
for header in response_headers:
response += '{0}: {1}\r\n'.format(*header)
# Add a newline , For and body To separate
response += '\r\n'
# Add data sent
for data in bodyContent:
response += data self.clientSocket.send(response)
finally:
self.clientSocket.close() # Set the port of the server
serverAddr = (HOST, PORT) = '', 8888
# Set the path of the server's static resources
documentRoot = './html'
# Set the path of server dynamic resources
pythonRoot = './wsgiPy' def makeServer(serverAddr, application):
server = WSGIServer(serverAddr)
server.setApp(application)
return server def main(): if len(sys.argv) < 2:
sys.exit(' Please follow the request , Specify module name : apply name , for example module:callable') # obtain module:callable
appPath = sys.argv[1]
# Cut according to the colon as module and callable
module, application = appPath.split(':')
# Add pathsets sys.path
sys.path.insert(0, pythonRoot)
# Dynamic import module Module specified in variable
module = __import__(module)
# obtain module Of the modules specified in the variable application Variable specified properties
application = getattr(module, application)
httpd = makeServer(serverAddr, application)
print('WSGIServer: Serving HTTP on port {port} ...\n'.format(port=PORT))
httpd.serveForever() if __name__ == '__main__':
main()

python And Web More articles on server cases

  1. Python Basics Web Server case

    One .WSGI 1.PythonWeb Server gateway interface (Python Web Server Gateway Interface, Abbreviation for WSGI) yes Python Application or framework and Web An interface between servers , ...

  2. python The Internet - dynamic Web Server case (30)

    One . Browser request HTML Page process I understand HTTP The protocol and HTML file , In fact, I understand a Web The essence of application is : Browser sends a HTTP request : The server receives the request , Generate a HTML file : Server handle HTML Documentation ...

  3. python The Internet - static state Web Server case (29)

    One . static state Web Server case code static_web_server.py # coding:utf-8 # Import socket modular import socket # Import regular expression module import re # ...

  4. Python build Web The server , And Ajax Interaction , Reception processing Get and Post The simple structure of the request

    use python build web The server , And ajax Interaction , Reception processing Get and Post request : Simple and practical , No framework , For simple needs , More functions can be extended . python It has its own module BaseHTTPServer.CGIHT ...

  5. python Write web The server

    #coding = utf-8 from http.server import BaseHTTPRequestHandler, HTTPServer class RequestHandler(Base ...

  6. ( turn )Python Of web The server

    1. Browser request dynamic page process 2.WSGI Python Web Server Gateway Interface ( Or abbreviation WSGI, pronounce as “wizgy”). WSGI Allow developers to choose web The framework and web ...

  7. Python Of web The server

    1. Browser request dynamic page process 2.WSGI Python Web Server Gateway Interface ( Or abbreviation WSGI, pronounce as “wizgy”). WSGI Allow developers to choose web The framework and web ...

  8. Python—— Lightweight web The server flask Learning from

    Preface : According to the needs of the project , Start the other one python The server ---flask,flask It's a lightweight python The server , Simple and easy to use . Record my learning process , New knowledge will be added in time . Records are just for better sharing ~ Text ...

  9. python Yes web The server does the stress test and makes the graphic display

    There are many tools for stress testing .apache Of , also jmeter, also loadrunner, It's all quite common . Actually, you use it yourself python Written , It's enough . Time should be counted in the process of stress test . Like concurrency per second , Maximum response per second ...

Random recommendation

  1. Hyper-V Activate Windows Solution to black screen after system restart + The activation methods

    Exception handling summary - clothing service device  http://www.cnblogs.com/dunitian/p/4522983.html Server related knowledge points :http://www.cnblogs.com/dunitia ...

  2. Laravel5.0 Study --03 Artisan command

    This article takes laravel5.0.22 For example . brief introduction Artisan yes Laravel Built in command line interface . It provides some useful commands to help you develop , It's made up of powerful Symfony Console Component driven . Take advantage of it , ...

  3. hdu 2087 Cut the flower cloth

    Topic link :http://acm.hdu.edu.cn/showproblem.php?pid=2087 Ideas : normal KMP solve aaaaaa  aa And what you get is 6, This is the question 3. Just change the code a little bit When the match is over ...

  4. from idea To ipo

    **************************************************************************************************** ...

  5. Linux command ln Use

    ln yes linux It's a very important order in , Its function is to create a link for a file in another location , The most common parameter for this command is -s, The specific usage is :ln –s Source file Target file . When we need to be in a different directory , When using the same file , ...

  6. Hibernate frame -- To configure , mapping , Primary key

    SSH frame : Struts frame , be based on mvc Application layer framework technology of pattern ! Hibernate,    Framework based on persistence layer ( Data access layer usage )! Spring,   Create objects, handle object dependencies, and integrate frameworks ! Da ...

  7. example 7-10 uva12212( Iteratively deepen the search )

    The question : For a number , You can cut a continuous natural number at a time , Paste to any part , Make it ascending Ideas : The idea is to search , Deep search is not guaranteed to be the shortest , I feel that there are too many situations on each floor . Iteration deepening : Enumerate search depth , And then deep search . This kind of prescription ...

  8. CodeForces Round #545 Div.2

    A. Sushi for Two Code : #include <bits/stdc++.h> using namespace std; ; ; int a[maxn], vis[maxn]; ...

  9. According to irregular polygons shp File splits the underlying grid file tif, Count the attribute values of different grids

    I want to do it , according to voronoi Polygon segmentation map land use type file , Count the types and numbers of different objects in each polygon .----- Pictured : My first thought is : First, use the upper polygon to cut the lower grid , Then you can count the land in the grid separately ...

  10. AS Import a project to appear Error:please select Android SDK Error of

    Importing a new project appears :Error:please select Android SDK Error of Phenomenon description : Click the run program button , Pop up a “Edit Configure” The dialog , At the bottom :Error:ple ...