最后
小编的一位同事在校期间连续三年参加ACM-ICPC竞赛。从参赛开始,原计划每天刷一道算法题,实际上每天有时候不止一题,一年最终完成了 600+:
凭借三年刷题经验,他在校招中很快拿到了各大公司的offer。
入职前,他把他的刷题经验总结成1121页PDF书籍,作为礼物赠送给他的学弟学妹,希望同学们都能在最短时间内掌握校招常见的算法及解题思路。
整本书,我仔细看了一遍,作者非常细心地将常见核心算法题和汇总题拆分为4个章节。
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
而对于有时间的同学,作者还给出了他结合众多数据结构算法书籍,挑选出的一千多道题的解题思路和方法,以供有需要的同学慢慢研究。
-
同一家公司的新旧应用之间
-
不同公司的应用之间
-
一些提供数据的内容聚合应用:天气预报、股票行情
4.1、WSDL(web service definition language)
WSDL是用来描述WebService的,它用XML的格式描述了WebService有哪些方法、参数类型、访问路径等等。我们要使用一个WebService肯定首先要获取它的WSDL,在VS中添加一个Web 引用时,这些工作由开发环境帮我们做了,开发环境根据WSDL文档给Web Service生成了相应的代理类供我们使用。
下面是一个HelloWorld的WebService的服务端代码:
[java] view plain copy
-
public class Service : System.Web.Services.WebService
-
{
-
public Service () {
-
//Uncomment the following line if using designed components
-
//InitializeComponent();
-
}
-
[WebMethod]
-
public DateTime HelloWorld(int i)
-
{
-
return DateTime.Now;
-
}
-
}
其对应的WebService的WSDL文档如下:
[html] view plain copy
-
<?xml version\="1.0" encoding\="utf-8"?>
-
wsdl:definitions xmlns:soap\=“http://schemas.xmlsoap.org/wsdl/soap/” xmlns:tm\=“http://microsoft.com/wsdl/mime/textMatching/” xmlns:soapenc\=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:mime\=“http://schemas.xmlsoap.org/wsdl/mime/” xmlns:tns\=“http://tempuri.org/” xmlns:s\=“http://www.w3.org/2001/XMLSchema” xmlns:soap12\=“http://schemas.xmlsoap.org/wsdl/soap12/” xmlns:http\=“http://schemas.xmlsoap.org/wsdl/http/” targetNamespace\=“http://tempuri.org/” xmlns:wsdl\=“http://schemas.xmlsoap.org/wsdl/”\
-
wsdl:types\
-
<s:schema elementFormDefault=“qualified” targetNamespace=“http://tempuri.org/”>
-
<s:element name=“HelloWorld”>
-
<s:complexType>
-
<s:sequence>
-
<s:element minOccurs=“1” maxOccurs=“1” name=“i” type=“s:int” />
-
</s:sequence>
-
</s:complexType>
-
</s:element>
-
<s:element name=“HelloWorldResponse”>
-
<s:complexType>
-
<s:sequence>
-
<s:element minOccurs=“1” maxOccurs=“1” name=“HelloWorldResult” type=“s:dateTime” />
-
</s:sequence>
-
</s:complexType>
-
</s:element>
-
</s:schema>
-
</wsdl:types>
-
wsdl:message name\=“HelloWorldSoapIn”\
-
wsdl:part name\=“parameters” element\=“tns:HelloWorld” /
-
</wsdl:message>
-
wsdl:message name\=“HelloWorldSoapOut”\
-
wsdl:part name\=“parameters” element\=“tns:HelloWorldResponse” /
-
</wsdl:message>
-
wsdl:portType name\=“ServiceSoap”\
-
wsdl:operation name\=“HelloWorld”\
-
wsdl:input message\=“tns:HelloWorldSoapIn” /
-
wsdl:output message\=“tns:HelloWorldSoapOut” /
-
</wsdl:operation>
-
</wsdl:portType>
-
wsdl:binding name\=“ServiceSoap” type\=“tns:ServiceSoap”\
-
soap:binding transport\=“http://schemas.xmlsoap.org/soap/http” /
-
wsdl:operation name\=“HelloWorld”\
-
soap:operation soapAction\=“http://tempuri.org/HelloWorld” style\=“document” /
-
wsdl:input\
-
soap:body use\=“literal” /
-
</wsdl:input>
-
wsdl:output\
-
soap:body use\=“literal” /
-
</wsdl:output>
-
</wsdl:operation>
-
</wsdl:binding>
-
wsdl:binding name\=“ServiceSoap12” type\=“tns:ServiceSoap”\
-
soap12:binding transport\=“http://schemas.xmlsoap.org/soap/http” /
-
wsdl:operation name\=“HelloWorld”\
-
soap12:operation soapAction\=“http://tempuri.org/HelloWorld” style\=“document” /
-
wsdl:input\
-
soap12:body use\=“literal” /
-
</wsdl:input>
-
wsdl:output\
-
soap12:body use\=“literal” /
-
</wsdl:output>
-
</wsdl:operation>
-
</wsdl:binding>
-
wsdl:service name\=“Service”\
-
wsdl:port name\=“ServiceSoap” binding\=“tns:ServiceSoap”\
-
soap:address location\=“http://localhost:2206/WebSite1/Service.asmx” /
-
</wsdl:port>
-
wsdl:port name\=“ServiceSoap12” binding\=“tns:ServiceSoap12”\
-
soap12:address location\=“http://localhost:2206/WebSite1/Service.asmx” /
-
</wsdl:port>
-
</wsdl:service>
-
</wsdl:definitions>
一个WSDL文档由四部分组成:
1、types
指定了WebService用到的所有数据类型,上面用到了两种数据类型,int和datetime
2、message
指明一个操作所用到的数据类型。
HelloWorldSoapIn是指HelloWorld的输入操作用到的数据类型,HelloWorldSoapOut是指HelloWorld的输出操作用到的数据类型。二者的element元素指出了与types中对应到的具体类型。
3、portType
指出了这个WebService所有支持的操作,就是说有哪些方法可供调用。
这里支持一个HelloWorld调用,它的输入和输出对应到HelloWorldSoapIn和HelloWorldSoapOut这个两个数据类型。
4、binding
soap12:binding元素的transport指明传输协议,这里是http协议。
operation 指明要暴露给外界调用的操作。
use属性指定输入输出的编码方式,这里没有指定编码。
5、services
指定服务的一些信息,主要是指定服务的访问路径。
4.2、SOAP(simple object access protocal)
如果我们要调用远程对象的方法,就必定要告诉对方,我们要调用的是一个什么方法,以及这个方法的参数的值等等。然后对方把数据返回给我们。
这其中就涉及到两个问题:1、数据如何在网络上传输。2、如何表示数据?用什么格式去表示函数以及它的参数等等。
1、SOAP的传输协议
SOAP的传输协议使用的就是HTTP协议。只不过HTTP传输的内容是HTML文本,而SOAP协议传输的是SOAP的数据。看一下下面的例子:
这是一个HTTP请求(请求google的首页)的内容:
[html] view plain copy
-
GET / HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
-
Accept-Language: en-us
-
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; CIBA) chromeframe/4.0
-
Accept-Encoding: gzip, deflate
-
Connection: Keep-Alive
-
Host: www.google.com
-
Cookie: PREF=ID=d8f9f1710bfa5f72:U=a5b3bec86b6433ef:NW=1:TM=1260238598:LM=1260241971:GM=1:S=q2agYsw3BsoOQMAs; NID=29=JgIGDDUx70IQTBVAnNEP_E9PLLKBI9STjzaBjgq1eWuDg-_jCgFpka59DrOC0aZKLbj4q77HU1VMKscXTP3OaseyTbv643c2XPe9dS7lsXDHAkAnS46vy-OU8XRqbmxJ; rememberme=true; SID=DQAAAH4AAABW7M4nVkTeOR7eJUmC1AJ4R6hYbmVewuy_uItLUTzZMUTpojdaHUExhPa_EPAkO9Ex1u3r7aPXZ5cj28xHnv2DbfRYf5AyaBcimciuOTITKSIkqn3QSpGDFkRS1Xn7EGzDpCV0V1xFlCu0erf_jfe_D6GOgC2P2S08jNdFS9Vpmw; HSID=AFEFTMA68EgNjkbil; __utmx=173272373.; __utmxx=173272373.
-
---------如果有Post的数据,这里还会有Post的数据--------
这个是一个SOAP请求的内容:
[html] view plain copy
-
POST /WebServices/WeatherWebService.asmx HTTP/1.1
-
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3603)
-
Content-Type: text/xml; charset=utf-8
Vue
-
什么是MVVM?
-
mvvm和mvc区别?它和其它框架(jquery)的区别是什么?哪些场景适合?
-
组件之间的传值?
-
Vue 双向绑定原理
-
描述下 vue 从初始化页面–修改数据–刷新页面 UI 的过程?
-
虚拟 DOM 实现原理
-
Vue 中 key 值的作用?
-
Vue 的生命周期
-
Vue 组件间通信有哪些方式?
-
vue 中怎么重置 data?
-
组件中写 name 选项有什么作用?
-
Vue 的 nextTick 的原理是什么?
-
Vuex 有哪几种属性?