0. SharePoint 2013使用_api来标识出 REST SERVICE,REST Service其实是 client.svc web service的一部分,但为了简化 REST URI的构造以及缩短REST URI的长度,使用 _api 来替代 _vti_bin/client.svc,例如, 你可以使用 http://server/site/_vti_bin/client.svc/web/lists 来替代 http://server/site/_api/web/lists;然而URL有256字符长度的限制,所以建议使用 _api 惯例;可参考此文章中的 Reference the SharePoint 2013 REST service in your endpoint URI 章节;

SharePoint 2013 REST Syntax Posters.pdf

工具:Chrome浏览器中的 Advanced Rest Client Application插件

1. Search REST API的query(GET)可以设置返回json格式的结果,存储在data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results中,results是个数据集合,序号从0开始;

2. 使用REST API获取(GET)数据时,若返回多条记录,则返回值存储在data.d.results中,results是个数据集合,序号从0开始,每一个result包含一个对象单元信息,例如:一个List Item的所有属性,如代码所示;若返回单条记录,则返回值存储在data.d中;

{
"__metadata":{"id":"b719e719-e4cc-445c-9c7c-0250aba4338a",
"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)",
"etag":"\"4\"","type":"SP.Data.TasksListItem"},
"FirstUniqueAncestorSecurableObject":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/FirstUniqueAncestorSecurableObject"}},
"RoleAssignments":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/RoleAssignments"}},
"AttachmentFiles":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/AttachmentFiles"}},
"ContentType":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/ContentType"}},
"FieldValuesAsHtml":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/FieldValuesAsHtml"}},
"FieldValuesAsText":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/FieldValuesAsText"}},
"FieldValuesForEdit":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/FieldValuesForEdit"}},
"File":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/File"}},
"Folder":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/Folder"}},
"ParentList":{"__deferred":{"uri":"https://gjq-11683d04060f3b.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'b44e6daf-ee1e-4249-987f-2f9305cdc884')/Items(1)/ParentList"}},
"FileSystemObjectType":0,
"Id":1,
"ContentTypeId":"0x0108005943A401D04CAD47AE81ABAA54AA39A3",
"Title":"Test",
"PredecessorsId":{"__metadata":{"type":"Collection(Edm.Int32)"},"results":[]},
"Priority":"(2) Normal",
"Status":"Not Started",
"PercentComplete":0.79,
"AssignedToId":11,
"TaskGroupId":null,
"Body":"<div></div>",
"StartDate":"2014-08-10T16:00:00Z",
"DueDate":"2014-08-27T16:00:00Z",
"RelatedItems":null,
"WorkflowLink":null,
"OffsiteParticipant":null,
"OffsiteParticipantReason":null,
"WorkflowOutcome":null,
"WorkflowName":null,
"GUID":"2c618f60-7fae-4689-a652-52458ae60dd6",
"ID":1,
"Modified":"2014-08-12T03:41:59Z",
"Created":"2014-08-11T01:57:18Z",
"AuthorId":11,
"EditorId":11,
"OData__UIVersionString":"4.0",
"Attachments":false
}

3. 使用REST API的一些建议:

  • If you’re not using the cross-domain library, include an X-RequestDigest header to send the form digest value in all POST requests and a content-lengthheader for POST requests that send data in the request body.

  • If you're not making cross-domain requests, remove SP.AppContextSite(@target) and ?@target='<host web url>' from the endpoint URI.

  • If you’re using OAuth, include an Authorization header ("Authorization": "Bearer " + <access token>) to send the OAuth access token.

  • If you want the server to return responses in Atom format, remove the "accept": "application/json; odata=verbose" header.

4. 使用REST API获取对象信息时,只能获取到当前级别信息,类似于Client Object Model,比如 /_api/web/lists可以获得所有list信息,但没有list item的信息;例如:一个List的所有属性,

{
"__metadata":
{
"id":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')",
"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')",
"etag":"\"3\"",
"type":"SP.List"
},
"FirstUniqueAncestorSecurableObject":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/FirstUniqueAncestorSecurableObject"}},
"RoleAssignments":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/RoleAssignments"}},
"ContentTypes":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/ContentTypes"}},
"CreatablesInfo":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/CreatablesInfo"}},
"DefaultView":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/DefaultView"}},
"DescriptionResource":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/DescriptionResource"}},
"EventReceivers":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/EventReceivers"}},
"Fields":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/Fields"}},
"Forms":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/Forms"}},
"InformationRightsManagementSettings":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/InformationRightsManagementSettings"}},
"Items":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/Items"}},
"ParentWeb":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/ParentWeb"}},
"RootFolder":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/RootFolder"}},
"TitleResource":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/TitleResource"}},
"UserCustomActions":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/UserCustomActions"}},
"Views":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/Views"}},
"WorkflowAssociations":{"__deferred":{"uri":"https://gjq-11683d04060f3f.sharepoint.com/BasicOperationApp/_api/Web/Lists(guid'9b64f833-6b28-4bf4-b02d-31e6f1d649e6')/WorkflowAssociations"}},
"AllowContentTypes":true,"BaseTemplate":100,"BaseType":0,"ContentTypesEnabled":false,"CrawlNonDefaultViews":false,"Created":"2014-08-12T05:22:25Z",
"DefaultContentApprovalWorkflowId":"00000000-0000-0000-0000-000000000000",
"Description":"",
"Direction":"none",
"DocumentTemplateUrl":null,
"DraftVersionVisibility":0,
"EnableAttachments":true,
"EnableFolderCreation":false,
"EnableMinorVersions":false,
"EnableModeration":false,
"EnableVersioning":false,
"EntityTypeName":"AccordionList",
"ForceCheckout":false,
"HasExternalDataSource":false,
"Hidden":false,
"Id":"9b64f833-6b28-4bf4-b02d-31e6f1d649e6",
"ImageUrl":"/_layouts/15/images/itgen.png?rev=37",
"IrmEnabled":false,
"IrmExpire":false,
"IrmReject":false,
"IsApplicationList":false,
"IsCatalog":false,
"IsPrivate":false,
"ItemCount":3,
"LastItemDeletedDate":"2014-08-12T05:22:25Z",
"LastItemModifiedDate":"2014-08-13T06:16:41Z",
"ListItemEntityTypeFullName":"SP.Data.AccordionListItem",
"MultipleDataList":false,
"NoCrawl":false,
"ParentWebUrl":"/",
"ParserDisabled":false,
"ServerTemplateCanCreateFolders":true,
"TemplateFeatureId":"00bfea71-de22-43b2-a848-c05709900100",
"Title":"Accordion"
}

5. REST Search API时,默认的rowlimit是10,即默认返回10条记录;

6. 使用REST API的POST方法创建新内容时,返回的信息存储在data.d中,比如data.d.Id;

7. REST API 不能修改文件夹的Name,详情请参考此处或者此处

8. REST API在更新file内容时,只能使用PUT,更新文件的metadata时,需要将文件看作一个item;

If you want to update a file's metadata, you'll have to construct an endpoint that reaches the file as a list item. You can do this because each folder is also a list, and each file is also a list item. Construct an endpoint that looks like this: https://<site url>/_api/web/lists/getbytitle('Documents')/items(<item id>). Working with lists and list items with REST explains how to update a list item's metadata.

9. 使用REST API获取item信息时,Look Up字段会发生一些变化,比如:有一个内部名称为Zone的列,查询出来的数据中找不到Zone列,而会有个ZoneId字段,值为被查询item的ID值;如果想得到Zone的显示名称,可使用$expand来获取:

1. 在$select=中可以写上Zone/Id,Zone/ColumnX;
2. 在$expand=中必须写上Zone; 注:Zone为当前列表的Look up字段;ColumnX为被查询列表的任何字段的内部名称;

10. 如果不使用cross-domain类库,在进行POST操作时,都要在headers中添加X-RequestDigest参数,默认赋值是$("#__REQUESTDIGEST").val();

11. 过滤操作需要使用$filter,例如,只需要Title字段以“B”开头的数据:$filter=startswith(Title, 'B');只需要Title字段包含“B”的数据:$filter=substringof('B',Title);

12. REST API - GET

       $.ajax({
url: "https://XXX.sharepoint.com/_api/web/lists/GetByTitle('XXX')/items",
type: "GET",
headers: {"Accept": "application/json;odata=verbose"},
success: function(data){
if(data.d.results){
var $selectObj = $("<select id='deptSelect'></select>");
$.each(data.d.results, function(index, item){
$selectObj.append($("<option></option>").attr("value", item.ID + item.Title).text(item.Title));
});
$("#getDiv").append($selectObj);
$("#getDiv").append("<br/>"+JSON.stringify(data.d.results));
}
},
error: function(xhr){
alert(xhr.status+': '+xhr.statusText);
}
});

注意:由于服务器端分页的限制,默认情况下,每次只能获取100条数据,但可以使用$top参数来指定一次要获取多少条数据,但最大不能超过5000;还可以使用__next来获取下一页的100条数据,请参考此处

13. REST API - POST (create)

        var newItem={
"__metadata":{"type": "SP.Data.Region_x0020_ApproversListItem"},
"Title": "Test Dept",
"Region": "GCN"
}; $.ajax({
url: "https://XXX.sharepoint.com/_api/web/lists/GetByTitle('XXX')/items",
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(newItem),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function(data){
alert(JSON.stringify(data.d.Id));
},
error: function(xhr){
alert(xhr.status+': '+xhr.statusText);
}
});

14. REST API - POST (update)

        var updatedItem={
"__metadata":{"type":"SP.Data.Region_x0020_ApproversListItem"},
"Title": "Test Dept Again"
}; $.ajax({
url: "https://XXX.sharepoint.com/_api/web/lists/GetByTitle('XXX')/items(40)",
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(updatedItem),
headers:{
"ACCEPT": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-METHOD": "MERGE",
"IF-MATCH": "*"

},
success: function(){ //此处没有data参数
getListItem();
},
error: function(xhr){
alert(xhr.status+': '+xhr.statusText);
}
});

15. REST API - DELETE

        $.ajax({
url: "https://XXX.sharepoint.com/_api/web/lists/GetByTitle('XXX')/items(43)",
type: "POST",
headers:{
"Accept": "application/json;odata=verbose",
"X-Http-Method": "DELETE",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"If-Match": "*"

},
success: function(data){
alert(JSON.stringify(data));
},
error: function(xhr){
alert(xhr.status+': '+xhr.statusText);
}
});

16. 在进行POST操作时,需要先得到metadata中的type属性值,方法是:http://XXXX/sites/XXX/_api/web/lists/getbytitle('listName')?$select=ListItemEntityTypeFullName

17. SharePoint 2016及 Office 365支持 REST API批量操作(Batch),可参考此处

18. REST API 使用的uri中,SharePoint名称(比如,列表名,列名)是大小写敏感的,oData的名称是大小写不敏感;在使用$filter等条件语句进行筛选对比时,非数字类型值需要添加单引号,比如 userName eq 'ABC';

19. 使用REST API获取当前用户的登录名:

<script type="text/javascript">
var userid= _spPageContextInfo.userId;
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
headers : requestHeaders,
success : onSuccess,
error : onError
}); function onSuccess(data, request){
var loginName = data.d.LoginName;
alert(loginName);
} function onError(error) {
alert("error");
}
</script>

20. 创建一个 Custom REST Service,可参考此文章;重要一点是:无需修改Web Config文件,只需要在.svc文件声明中加入以下代码即可:

<%@ ServiceHost Language="C#" Debug="true" Service="SPRESTService.CustomRESTService, $SharePoint.Project.AssemblyFullName$"
CodeBehind="CustomRESTService.svc.cs"
Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory,
Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c"
%>

如需在声明中使用 token 符 "$SharePoint.Project.AssemblyFullName$",需要在project文件(.csproj文件) 中加入以下代码:

<PropertyGroup>
...
<SandboxedSolution>False</SandboxedSolution>
<TokenReplacementFileExtensions>svc</TokenReplacementFileExtensions>
</PropertyGroup>

21. 在Custom REST Service时, 每个 OperationContract的 Name属性用于标识这个操作,是唯一的,在返回值中可以体现出来,返回值为 Name + 'Result',例如,在ajax回调函数中使用时即为 response.GetAllPresidentsResult ;UriTemplate属性是访问此操作的路径,也是唯一的;

22. 若要获取一个web根目录下的所有folder,可以使用一下REST API:

http://site url/_api/web/folders

得到的结果即是在SPD中看到的样子:

REST返回的结果可能还会包含一下以"_vti_"开头的文档库或列表地址,这些是FrontPage的遗产物,无需在意,详情可参考此文章

23. SharePoint REST API中的 /folders 和 /files 接口都只能得到当前文件夹下的 子文件夹 或者 文件,而不能递归读取所有 子文件夹 或 文件;

http://host url/sites/jacky/_api/Web/GetFolderByServerRelativeUrl('/sites/jacky/Documents')/Files
http://host url/sites/jacky/_api/Web/GetFolderByServerRelativeUrl('/sites/jacky/Documents')/Folders

而 /items 接口却可以得到一个 list 或者 library 所有item,包括文件和文件夹;

http://host url/sites/jacky/_api/Web/Lists(guid'9957f1e6-a35a-4888-a770-d5325c5cfe74')/Items

24. $expand 相当于扩展查询,将子查询对象的结果集成到当前这次调用中来,比如:

使用 http://host url/sites/jacky/_api/Web/GetFolderByServerRelativeUrl('/sites/jacky/Documents') 接口我们可以得到Documents 这个文件夹的一些信息,返回结果如下:

如果加上$expand 对象,将 REST URI 改为:http://host url/sites/jacky/_api/Web/GetFolderByServerRelativeUrl('/sites/jacky/Documents')?$expand=Folders,Files 即 加上了 查询Folders 和 Files的子语句,返回的结果为:

相当于,在查询当前文件夹信息的同时,也进行了下面两个查询,并将结果一次性返回:

http://host url/sites/jacky/_api/Web/GetFolderByServerRelativeUrl('/sites/jacky/Documents')/Files
http://host url/sites/jacky/_api/Web/GetFolderByServerRelativeUrl('/sites/jacky/Documents')/Folders

25. 在使用$select时,如果需要选择的属性位于一个集合(例如 results)中,那么在路径中可以忽略掉 results (此为虚拟节点),直接写需要的属性,比如下图,如果需要选择 Title属性,不需要写成:$select=ListItemAllFields/RoleAssignments/results/Member/Users/results/Title,直接写成 $select=ListItemAllFields/RoleAssignments/Member/Users/Title 即可;

26.

SharePoint 2013 - REST Service的更多相关文章

  1. SharePoint 2013 安装 Service Pack 1

    Problem 当迁移SharePoint 的时候,执行Move-SPSite 命令,将指定的Site Collection移动到目标内容数据库中时,提示以下错误:Cannot complete th ...

  2. How to Call SharePoint 2013 API Service to Query The Lists

    How to Call SharePoint 2013 API In SharePoint 2013, we can query the list by it owner service, then ...

  3. 修复SharePoint 2013 Search 拓扑错误

    Problem 当创建和配置SharePoint 2013 Search Service Application成功之后,进入详细配置页后,在Search Application Topology节点 ...

  4. SharePoint 2013中的爬网最佳做法

    了解在 SharePoint Server 2013 中爬网的最佳做法 搜索系统对内容进行爬网,以构建一个用户可以对其运行搜索查询的搜索索引.本文包含有关如何最有效地管理爬网的建议. 本文内容: 使用 ...

  5. SharePoint 2013 Service 状态无法启动,显示“启动中(Starting)”

    Problem 在SharePoint 2013 Central Administration中启动 SharePoint Service(也称为:Service Machine Instance)时 ...

  6. SharePoint 2013 使用PowerShell创建State Service

    今天,搞SPD配置的sp2010wf迁移到sp2013环境上去,发布解决方案都很正常,给列表添加wf的时候报错“该表单无法显示,可能是由于 Microsoft SharePoint Server St ...

  7. Customize the SharePoint 2013 search experience with a Content Enrichment web service

    Did you ever wish you had more control over how your content is indexed and presented as search resu ...

  8. SharePoint 2013 APP 开发示例 (六)服务端跨域访问 Web Service (REST API)

    上个示例(SharePoint 2013 APP 开发示例 (五)跨域访问 Web Service (REST API))是基于JavaScript,运行在web browser内去访问REST AP ...

  9. SharePoint 2013 APP 开发示例 (五)跨域访问 Web Service (REST API)

          虽然 JQuery 也能通过授权header实现跨域, 但SharePoint 提供了更简单的方法,它被实现在SP.RequestExecutor里 .它能访问跨域的服务包括REST AP ...

随机推荐

  1. [国家集训队]部落战争 最大流 BZOJ2150

    题目描述 lanzerb的部落在A国的上部,他们不满天寒地冻的环境,于是准备向A国的下部征战来获得更大的领土. A国是一个M*N的矩阵,其中某些地方是城镇,某些地方是高山深涧无人居住.lanzerb把 ...

  2. Tomcat 配置文件的解析

    转载:https://www.cnblogs.com/sunshine-1/p/8990044.html https://www.cnblogs.com/kismetv/p/7228274.html ...

  3. pip 使用代理

    pip install -i https://mirrors.aliyun.com/pypi/simple/ opencv-python 红色部分 代表使用 阿里云 代理 安装 pip

  4. C++_类和动态内存分配3-构造函数中使用new的注意事项

    如果在构造函数中使用new来初始化对象的指针成员时必须特别小心. 1 如果在构造函数中使用new来初始化指针成员,则应在析构函数中使用delete. 2 new和delete必须相互兼容.new对应于 ...

  5. hdu4513吉哥系列故事——完美队形II 马拉车

    题目传送门 题意:求最长回文串长度,要求回文串左边是非下降. 思路一: 先把连续的回文串,满足先上升再下降的序列处理出来,再对这部分序列做马拉车模板就可以了. 需要注意的是,由于他要的是非下降的序列, ...

  6. POJ - 2018 二分+单调子段和

    依然是学习分析方法的一道题 求一个长度为n的序列中的一个平均值最大且长度不小于L的子段,输出最大平均值 最值问题可二分,从而转变为判定性问题:是否存在长度大于等于L且平均值大于等于mid的字段和 每个 ...

  7. sqlmap命令小结

    --technique 这个参数可以指定sqlmap使用的探测技术,默认情况下会测试所有的方式. 支持的探测方式如下: B: Boolean-based blind SQL injection(布尔型 ...

  8. Tesorflow-自动编码器(AutoEncoder)

    直接附上代码: import numpy as np import sklearn.preprocessing as prep import tensorflow as tf from tensorf ...

  9. Linux总线设备驱动模型

    1. Linux2.6内核引入总线.设备.驱动模型来描述各种总线(PCI.USB.I2C.SPI)与外围设备及其驱动之间的关系. 2. 在Linux内核中,总线用bus_type结构来描述,定义于文件 ...

  10. pat00-自测3. 数组元素循环右移问题 (20)

    00-自测3. 数组元素循环右移问题 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 一个数组A中存有N(N>0)个整数,在 ...