jQuery-Word-Export 使用记录及完整修正文件下载 jquery.wordexport.js

参考资料: jQuery-Word-Export导出word_jquery.wordexport.js下载-CSDN博客

近期又需要自己做个 Html2Doc 的解决方案,因为客户又不想要 Html2pdf 的下载了,当初还给我费尽心思解决Html转pdf时中文输出的问题(html转pdf文件下载之最合理的方法支持中文_jspdf.umd.min.js-CSDN博客)以及手机端下载pdf的问题(手机端 Android WebView 获取 blob 链接文件名并下载网页动态生成的 pdf 文件且调用外部程序打开_blob链接怎么打开-CSDN博客)

查了下,基于 IIS 的解决方案,感觉还是参考资料中的相对靠谱,测试了一下,页面上的例子正确工作,输出文件正确,之后逐步添加不同元素测试也正常,但是到加了 img 时就报错了:

问 AI 说是叫检查 jquery.word.export.js 的第 33行:

$('<canvas>').attr("id", "test_word_img_" + i).width(w).height(h).insertAfter(img_id);

看了前后代码,发现是 img 元素没有 id 造成的,这样的话,就需要修复 jquery.word.export.js,以下是修复后的代码,不管 img 有没有 id 都能正确输出了,当然,是交给通义千问去修复的:

if (typeof jQuery !== "undefined" && typeof saveAs !== "undefined") {(function ($) {$.fn.wordExport = function (fileName) {fileName = typeof fileName !== 'undefined' ? fileName : "jQuery-Word-Export";var static = {mhtml: {top: "Mime-Version: 1.0\nContent-Base: " + location.href + "\nContent-Type: Multipart/related; boundary=\"NEXT.ITEM-BOUNDARY\";type=\"text/html\"\n\n--NEXT.ITEM-BOUNDARY\nContent-Type: text/html; charset=\"utf-8\"\nContent-Location: " + location.href + "\n\n<!DOCTYPE html>\n<html>\n_html_</html>",head: "<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n<style>\n_styles_\n</style>\n</head>\n",body: "<body>_body_</body>"}};var options = {maxWidth: 624};// Clone selected element before manipulating it  var markup = $(this).clone();// Remove hidden elements from the output  markup.each(function () {var self = $(this);if (self.is(':hidden'))self.remove();});// Embed all images using Data URLs  var images = Array();var img = markup.find('img');for (var i = 0; i < img.length; i++) {// Calculate dimensions of output image  var w = Math.min(img[i].width, options.maxWidth);var h = img[i].height * (w / img[i].width);// Ensure each image has a unique idvar img_id = img[i].id || "dynamic_img_" + i;if (!img[i].id) {$(img[i]).attr("id", img_id);}$('<canvas>').attr("id", "test_word_img_" + i).width(w).height(h).insertAfter("#" + img_id);// Create canvas for converting image to data URL  var canvas = document.createElement("CANVAS");canvas.width = w;canvas.height = h;// Draw image to canvas  var context = canvas.getContext('2d');context.drawImage(img[i], 0, 0, w, h);// Get data URL encoding of image  var uri = canvas.toDataURL("image/png");// Save encoded image to array  images[i] = {type: uri.substring(uri.indexOf(":") + 1, uri.indexOf(";")),encoding: uri.substring(uri.indexOf(";") + 1, uri.indexOf(",")),location: "#" + img_id,data: uri.substring(uri.indexOf(",") + 1)};// Replace original image with canvas in markup$("#" + img_id).replaceWith(canvas);}// Prepare bottom of mhtml file with image data  var mhtmlBottom = "\n";for (var i = 0; i < images.length; i++) {mhtmlBottom += "--NEXT.ITEM-BOUNDARY\n";mhtmlBottom += "Content-Location: " + images[i].location + "\n";mhtmlBottom += "Content-Type: " + images[i].type + "\n";mhtmlBottom += "Content-Transfer-Encoding: " + images[i].encoding + "\n\n";mhtmlBottom += images[i].data + "\n\n";}mhtmlBottom += "--NEXT.ITEM-BOUNDARY--";//TODO: load css from included stylesheet  var styles = "";// Aggregate parts of the file together  var fileContent = static.mhtml.top.replace("_html_", static.mhtml.head.replace("_styles_", styles) + static.mhtml.body.replace("_body_", markup.html())) + mhtmlBottom;// Create a Blob with the file contents  var blob = new Blob([fileContent], {type: "application/msword;charset=utf-8"});saveAs(blob, fileName + ".doc");};})(jQuery);
} else {if (typeof jQuery === "undefined") {console.error("jQuery Word Export: missing dependency (jQuery)");}if (typeof saveAs === "undefined") {console.error("jQuery Word Export: missing dependency (FileSaver.js)");}
}

中间还遇到 img 标签中 src 使用其他网站的链接也会报错:

但是这是由于跨域问题,因此将图片放置到网站本地即可:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Export to DOCX</title><script src="./js/jquery-3.3.1.min.js"></script><script src="./js/FileSaver.js"></script><script src="./js/jquery.wordexport.js"></script>
</head>
<body>
<div id="contentAA"><h1>这是一个标题</h1><h1> Your content here...</h1><p>这是段落内容。</p><img src="./img/01.png" alt="示例图片">	<table border="1"><tr><th>表头1</th><th>表头2</th></tr><tr><td>数据1</td><td>数据2</td></tr></table><img src="./img/02.png" alt="示例图片">	
</div>
<hr/>
<button id="export">导出</button><script>$("#export").click(function(){$("#contentAA").wordExport();});</script>
</body>
</html>

图片也正常导出了,打开导出的文件看了一下,发现是个加了壳的 Html 文件,仔细看了下格式,发现这是 Mhtml 格式的,也即 .MHT 单个网页文件格式:

Mime-Version: 1.0
Content-Base: http://127.0.0.1/html2doc02.html
Content-Type: Multipart/related; boundary="NEXT.ITEM-BOUNDARY";type="text/html"--NEXT.ITEM-BOUNDARY
Content-Type: text/html; charset="utf-8"
Content-Location: http://127.0.0.1/html2doc02.html<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style></style>
</head>
<body><h1>这是一个标题</h1><h1> Your content here...</h1><p>这是段落内容。</p><img src="./img/01.png" alt="示例图片" id="dynamic_img_0">	<table border="1"><tbody><tr><th>表头1</th><th>表头2</th></tr><tr><td>数据1</td><td>数据2</td></tr></tbody></table><img src="./img/02.png" alt="示例图片" id="dynamic_img_1">	
</body></html>
--NEXT.ITEM-BOUNDARY
Content-Location: #dynamic_img_0
Content-Type: image/png
Content-Transfer-Encoding: base64iVBORw0KGgoAAAANSUhEUgAAAFAAAAAwCAYAAACG5f33AAAAAXNSR0IArs4c6QAABRFJREFUaEPtm71rFEEUwN8Zc8ldbAykUjuttJBYSCzEgKLiByiksEghiqKi4EchEQwRjFFiAkoExUKwEKIRESwEC/FvUBS0EKKFJCTx43I5v1beyCxz72Z33ps99i5w297szHu/fd+TZIIgCKDxeBPINAB6s1MvNgAm49cAmJBfA2DNAP5+8xZ+PnoMP5+/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GMKkVsBbMke9YFQFu2MpVAIc1syL1D1fvGZVKbu0qyZxxAST0pCRvWPy6iG+iaL7t9mxpemq2U5A7V10IkCkWdIaknJeexAEYJZQv6Lkhxv0cJLlGI04m46knJed4A6XjdnJJw3ZoqGyW4782dub8EimStN0DqEnpKYoLlzN44Svre3HH2tllsKgBNq9AuYbv0kTT/UYLTDsWnnJFAkaz1tkCaVW3wXLGG68K4Lkk5I43VqQCkypvjLVrqcBNLnOA+dxv6XOlEuyYApRNrn9hDrdCcG0Z9JFr/cSbaNQHItTKfMka/Q63Q50xOTF6UALmdQhKI3JhsWroLuDOJ4ATFNbZyWQJnrCXpFFwDC5s8XHj4Lqft1GdYAdLe1wWo2r9LlK322dL9rACTuIlUANt6l9tU44xq7RH5n0rVyKoopNTdFpP1oX6Nf/VKaIoNgA2ACQkkfP0f773NrWxc5+8AAAAASUVORK5CYII=--NEXT.ITEM-BOUNDARY
Content-Location: #dynamic_img_1
Content-Type: image/png
Content-Transfer-Encoding: base64iVBORw0KGgoAAAANSUhEUgAAABMAAAALCAYAAACd1bY6AAAAAXNSR0IArs4c6QAAAHRJREFUOE9j/P///38GKgFGUgxT3uSLYu1dv80ofBTD0BXDVMI0geSxsWHqMAxDtw2XAcjiGIbBXIXPMGQ/ETQM3SCQZmyacFkM9yYxLkMOU2wWY40AZIUwl+GyDNnrGEkDW4yCDMcV08gxTlI6I5S2qWoYAMYcbeBk+Zz2AAAAAElFTkSuQmCC--NEXT.ITEM-BOUNDARY--

既然如此,那么就有很多方法可以输出这种格式的文件了。不一定非得用 jQuery-Word-Export 了,而且从代码看 jquery.wordexport.js ,还可以做很多优化和自定义,现在这个只能勉强算是验证,还不能投入实用。

刚刚测试了 <img src="data:image/png;base64,  格式的图片,发现无法输出后无法在 word 2003 中显示,是因为没有处理 Src 和图片资源区 Content-Location: #dynamic_img_0 这样的设置不对造成的,按照 MHTML 格式规范,手工修改了一下下载的文件,在 Word 2003 里面就能正确显示图片了:

Mime-Version: 1.0
Content-Type: Multipart/related; boundary="NEXT.ITEM-BOUNDARY";type="text/html"--NEXT.ITEM-BOUNDARY
Content-Type: text/html; charset="utf-8"<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style></style>
</head>
<body><h1>这是一个标题</h1><p>这是段落内容。</p><img src="02.png" alt="示例图片">	<table border="1"><tbody><tr><th>表头1</th><th>表头2</th></tr><tr><td>数据1</td><td>数据2</td></tr></tbody></table><img src="01.png" alt="示例图片">	
</body></html>
--NEXT.ITEM-BOUNDARY
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Location: 01.pngiVBORw0KGgoAAAANSUhEUgAAAFAAAAAwCAYAAACG5f33AAAAAXNSR0IArs4c6QAABRFJREFUaEPtm71rFEEUwN8Zc8ldbAykUjuttJBYSCzEgKLiByiksEghiqKi4EchEQwRjFFiAkoExUKwEKIRESwEC/FvUBS0EKKFJCTx43I5v1beyCxz72Z33ps99i5w297szHu/fd+TZIIgCKDxeBPINAB6s1MvNgAm49cAmJBfA2DNAP5+8xZ+PnoMP5+/gL+TnxLJsWTVSsidPgktPfsT7VOLlyti4K+Xr6A4eA3+fJmCYGYmNZkyLS2w/MPr1M6LOwgZLNy6A9me/c6PWgFwrnMT/J2eBqhBddM++b4uACoGU1PA+agVAGdWrQEsDDMOVZZ0dEB2x1Zo3rMLmrs2eiuO5+mnXgBKZLICTFMhibBRX6n08DEUR2+qn5tWrlAftbX3QCofddEDLI7cCOGZxDAp5c6c8oIo+ag1Bzi7eh0EpZJSNHf+HOROHGUpjYG+0NcfWwH4ZvdUAWpFFACPUmR+4DIs3L33vy0SZGId6DXt5i2bYdnYKPw4cRpQJv1I9tTvpArQVMRHWLQ+tEJu3LVZXsve3ZAfGVIfAPeb7+uH0vhEuKfEsvGl1ADS+IOBOz94ieWC5iKuwAgPLSz49i18HeG1jY1WnEktO3/lkrOmS9UCKbwoRTg0uQCp25qWR89BS5xbuyGMr2idXIhceVTYoeMs18s2F1Lx5+4t5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
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Location: 02.pngiVBORw0KGgoAAAANSUhEUgAAABMAAAALCAYAAACd1bY6AAAAAXNSR0IArs4c6QAAAHRJREFUOE9j/P///38GKgFGUgxT3uSLYu1dv80ofBTD0BXDVMI0geSxsWHqMAxDtw2XAcjiGIbBXIXPMGQ/ETQM3SCQZmyacFkM9yYxLkMOU2wWY40AZIUwl+GyDNnrGEkDW4yCDMcV08gxTlI6I5S2qWoYAMYcbeBk+Zz2AAAAAElFTkSuQmCC--NEXT.ITEM-BOUNDARY--

下一步就是继续修正 jquery.word.export.js 让它能正确按照这个格式输出文件,并且正确处理 <img  的 Src 属性。 

下面补充一下 FileSaver.js ,省得还要去 github下载,好麻烦:

/* FileSaver.js * A saveAs() FileSaver implementation. * 1.3.2 * 2016-06-16 18:25:19 * * By Eli Grey, http://eligrey.com * License: MIT *   See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md */  /*global self */  
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */  /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */  var saveAs = saveAs || (function(view) {  "use strict";  // IE <10 is explicitly unsupported  if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {  return;  }  var  doc = view.document  // only get URL when necessary in case Blob.js hasn't overridden it yet  , get_URL = function() {  return view.URL || view.webkitURL || view;  }  , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")  , can_use_save_link = "download" in save_link  , click = function(node) {  var event = new MouseEvent("click");  node.dispatchEvent(event);  }  , is_safari = /constructor/i.test(view.HTMLElement)  , is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent)  , throw_outside = function(ex) {  (view.setImmediate || view.setTimeout)(function() {  throw ex;  }, 0);  }  , force_saveable_type = "application/octet-stream"  // the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to  , arbitrary_revoke_timeout = 1000 * 40 // in ms  , revoke = function(file) {  var revoker = function() {  if (typeof file === "string") { // file is an object URL  get_URL().revokeObjectURL(file);  } else { // file is a File  file.remove();  }  };  setTimeout(revoker, arbitrary_revoke_timeout);  }  , dispatch = function(filesaver, event_types, event) {  event_types = [].concat(event_types);  var i = event_types.length;  while (i--) {  var listener = filesaver["on" + event_types[i]];  if (typeof listener === "function") {  try {  listener.call(filesaver, event || filesaver);  } catch (ex) {  throw_outside(ex);  }  }  }  }  , auto_bom = function(blob) {  // prepend BOM for UTF-8 XML and text/* types (including HTML)  // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF  if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {  return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type});  }  return blob;  }  , FileSaver = function(blob, name, no_auto_bom) {  if (!no_auto_bom) {  blob = auto_bom(blob);  }  // First try a.download, then web filesystem, then object URLs  var  filesaver = this  , type = blob.type  , force = type === force_saveable_type  , object_url  , dispatch_all = function() {  dispatch(filesaver, "writestart progress write writeend".split(" "));  }  // on any filesys errors revert to saving with object URLs  , fs_error = function() {  if ((is_chrome_ios || (force && is_safari)) && view.FileReader) {  // Safari doesn't allow downloading of blob urls  var reader = new FileReader();  reader.onloadend = function() {  var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;');  var popup = view.open(url, '_blank');  if(!popup) view.location.href = url;  url=undefined; // release reference before dispatching  filesaver.readyState = filesaver.DONE;  dispatch_all();  };  reader.readAsDataURL(blob);  filesaver.readyState = filesaver.INIT;  return;  }  // don't create more object URLs than needed  if (!object_url) {  object_url = get_URL().createObjectURL(blob);  }  if (force) {  view.location.href = object_url;  } else {  var opened = view.open(object_url, "_blank");  if (!opened) {  // Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html  view.location.href = object_url;  }  }  filesaver.readyState = filesaver.DONE;  dispatch_all();  revoke(object_url);  }  ;  filesaver.readyState = filesaver.INIT;  if (can_use_save_link) {  object_url = get_URL().createObjectURL(blob);  setTimeout(function() {  save_link.href = object_url;  save_link.download = name;  click(save_link);  dispatch_all();  revoke(object_url);  filesaver.readyState = filesaver.DONE;  });  return;  }  fs_error();  }  , FS_proto = FileSaver.prototype  , saveAs = function(blob, name, no_auto_bom) {  return new FileSaver(blob, name || blob.name || "download", no_auto_bom);  }  ;  // IE 10+ (native saveAs)  if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {  return function(blob, name, no_auto_bom) {  name = name || blob.name || "download";  if (!no_auto_bom) {  blob = auto_bom(blob);  }  return navigator.msSaveOrOpenBlob(blob, name);  };  }  FS_proto.abort = function(){};  FS_proto.readyState = FS_proto.INIT = 0;  FS_proto.WRITING = 1;  FS_proto.DONE = 2;  FS_proto.error =  FS_proto.onwritestart =  FS_proto.onprogress =  FS_proto.onwrite =  FS_proto.onabort =  FS_proto.onerror =  FS_proto.onwriteend =  null;  return saveAs;  
}(  typeof self !== "undefined" && self  || typeof window !== "undefined" && window  || this.content  
));  
// `self` is undefined in Firefox for Android content script context  
// while `this` is nsIContentFrameMessageManager  
// with an attribute `content` that corresponds to the window  if (typeof module !== "undefined" && module.exports) {  module.exports.saveAs = saveAs;  
} else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) {  define([], function() {  return saveAs;  });  
}  

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/60771.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

第8章 文件上传与下载

第八章 文件上传与下载 8.1 文件上传 使用SpringMVC6版本&#xff0c;不需要添加以下依赖&#xff1a; <dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.5</version> …

sql工具!好用!爱用!

SQLynx的界面设计简洁明了&#xff0c;操作逻辑清晰易懂&#xff0c;没有复杂的图标和按钮&#xff0c;想对哪部分操作就在哪里点击右键&#xff0c;即使你是数据库小白也能轻松上手。 尽管SQLynx是一款免费的工具&#xff0c;但是它的功能却丝毫不逊色于其他付费产品&#xff…

Pytest-Bdd-Playwright 系列教程(13):钩子(hooks)

Pytest-Bdd-Playwright 系列教程&#xff08;13&#xff09;&#xff1a;钩子&#xff08;hooks&#xff09; 前言一、什么是钩子&#xff1f;二、Pytest-Bdd 提供的钩子一览三、钩子用法详解1. pytest_bdd_before_scenario2. pytest_bdd_after_scenario3. pytest_bdd_before_s…

竞赛经验:关于不记得字母表,如何知道字母顺序qwq

利用ASCII码算出码值再转成字符即可 #include <bits/stdc.h> using namespace std;int main() {for(int i 1; i < 30; i){cout << char(ai) << ;} }结果&#xff1a; ps:大意了&#xff0c;本想用电脑目录&#xff0c;但没考虑到会有文件不存在导致缺…

[Unity Demo]从零开始制作空洞骑士Hollow Knight第二十集:制作专门渲染HUD的相机HUD Camera和画布HUD Canvas

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、制作HUD Camera以及让两个相机同时渲染屏幕二、制作HUD Canvas 1.制作法力条Soul Orb引入库2.制作生命条Health读入数据3.制作吉欧统计数Geo Counter4.制作…

python excel接口自动化测试框架!

今天采用Excel继续写一个接口自动化测试框架。 设计流程图 这张图是我的excel接口测试框架的一些设计思路。 首先读取excel文件&#xff0c;得到测试信息&#xff0c;然后通过封装的requests方法&#xff0c;用unittest进行测试。 其中&#xff0c;接口关联的参数通过正则进…

泷羽sec-linux

基础之linux 声明&#xff01; 学习视频来自B站up主 泷羽sec 有兴趣的师傅可以关注一下&#xff0c;如涉及侵权马上删除文章&#xff0c;笔记只是方便各位师傅的学习和探讨&#xff0c;文章所提到的网站以及内容&#xff0c;只做学习交流&#xff0c;其他均与本人以及泷羽sec团…

卷积神经网络学习记录

目录 神经网络基础定义&#xff1a; 基本组成部分 工作流程 卷积层&#xff08;卷积定义&#xff09;【CONV】&#xff1a; 卷积层&#xff08;Convolutional Layer&#xff09; 特征提取&#xff1a;卷积层的主要作用是通过卷积核&#xff08;或滤波器&#xff09;运算提…

计算机网络-GRE(通用路由封装协议)简介

昨天我们学习了VPN的基本概念&#xff0c;虚拟专用网络在当前企业总部与分支间广泛使用。常用的划分方法为基于协议层次有GRE VPN、IPSec VPN、L2TP VPN、PPTP VPN、SSL VPN等。其实我有考虑该怎么讲&#xff0c;因为在IP阶段好像虚拟专用网络讲得不深&#xff0c;在IE的阶段会…

SeggisV1 源码技术指导文档

软件下载地址&#xff1a; 百度网盘&#xff1a;链接:https://pan.baidu.com/s/1ZtwVcLsLypGo5lH6qR9oTw?pwd5856 问题咨询&#xff1a; https://github.com/YangJing524/Seggis

VSCode Terminal无法运行node以及node-gyp等指令

无法使用node指令&#xff0c;使用管理员权限启动VSCode即可&#xff0c;或者右键VSCode属性&#xff0c;修改兼容性中使用管理员权限打开。 运行node-gyp等指令出现因为在此系统上禁止运行脚本。有关详细信息&#xff0c;请参阅 https:/go.microsoft.com/fwlink/?LinkID1351…

前端全栈 === 快速入 门 Redis

目录 简介 通过 docker 的形式来跑&#xff1a; set、get 都挺简单&#xff1a; incr 是用于递增的&#xff1a; keys 来查询有哪些 key: redis insight GUI 工具。 list 类型 left push rpush lpop 和 rpop 自然是从左边和从右边删除数据。​编辑 如果想查看数据…

计算机网络socket编程(2)_UDP网络编程实现网络字典

个人主页&#xff1a;C忠实粉丝 欢迎 点赞&#x1f44d; 收藏✨ 留言✉ 加关注&#x1f493;本文由 C忠实粉丝 原创 计算机网络socket编程(2)_UDP网络编程实现网络字典 收录于专栏【计算机网络】 本专栏旨在分享学习计算机网络的一点学习笔记&#xff0c;欢迎大家在评论区交流讨…

简单链式表

# 完成双向循环链表的判空、尾插、遍历、尾删 class Node:def __init__(self, value):self.value valueself.next Noneself.prev None class Linklist:def __init__(self,nodeNone):self.head nodeself.size 0def is_empty(self):return self.size 0def add_tail(self,va…

流水线切分策略;通过自适应的重采样和重计算策略来优化计算资源和内存使用

目录 流水线切分策略 1,2,3,4,5指的计算任务(数据切分) 大方块代表GPU计算 黄色代表显存 通过自适应的重采样和重计算策略来优化计算资源和内存使用 一是自适应重计算(Adaptive Recomputation) 二是自适应划分(Adaptive Partitioning) 流水线切分策略 1,2,3,4,5指…

不只是请求和响应:使用Fiddler抓包URL和Method全指南(中)

欢迎浏览高耳机的博客 希望我们彼此都有更好的收获 感谢三连支持! 不只是请求和响应&#xff1a;使用Fiddler抓包HTTP协议全指南(上)-CSDN博客https://blog.csdn.net/Chunfeng6yugan/article/details/144005872?spm1001.2014.3001.5502 &#x1f649;在(上)篇博客中&#xf…

卷积神经网络(CNN)中的批量归一化层(Batch Normalization Layer)

批量归一化层&#xff08;BatchNorm层&#xff09;&#xff0c;或简称为批量归一化&#xff08;Batch Normalization&#xff09;&#xff0c;是深度学习中常用的一种技术&#xff0c;旨在加速神经网络的训练并提高收敛速度。 一、基本思想 为了让数据在训练过程中保持同一分布…

前端速通(CSS)

1.CSS介绍 1.什么是CSS? CSS&#xff08;Cascading Style Sheets&#xff0c;层叠样式表&#xff09;是一种用于控制网页的外观和布局的样式表语言。它与HTML&#xff08;超文本标记语言&#xff09;紧密配合&#xff0c;负责页面元素的样式定义&#xff0c;如字体、颜色、尺…

webkit浏览器内核编译(2024年11月份版本)

webkit浏览器内核编译 本文详细介绍了如何安装和配置Webkit的编译环境和工具的安装&#xff0c;以及在Windows上编译和运行WebKit浏览器引擎的过程&#xff0c;包括安装依赖、设置环境变量、生成解决方案并最终运行附带的MiniBrowser示例。 一、WebKit简介 WebKit 是一个开源的…

C++趣味编程玩转物联网:用树莓派Pico实现一位数码管动态显示

七段数码管是一种经典的电子显示器件&#xff0c;广泛应用于数字时钟、电子仪表等设备。本文将通过树莓派Pico开发板&#xff0c;介绍如何用C代码控制一位七段数码管显示数字。作为一个嵌入式开发项目&#xff0c;这不仅是初学者理解数码管工作原理的好机会&#xff0c;也是C开…