在quill编辑器中集成秀米和135编辑器

前端100道八股文+50道场景题 闭包是指一个函数能够访问它外部函数作用域中的变量,即使外部函数已经执行完毕。形成闭包需要三个条件:函数嵌套、内部函数引用外部变量、外部函数返回内部函数。闭包的主要作用有三个:第一,实现数据私有化。比如可以用闭包创建私有变量,外部无法直接访问,只能通过特定方法操作。第二,模块化。可以用闭包封装代码,只暴露需要的接口。第三,函数柯里化和防抖节流等高级技巧都会用到闭包。闭包的缺点是可能造成内存泄漏。因为闭包引用的外部变量不会被垃圾回收,如果大量使用闭包且不及时清理,会占用过多内存。 阅读详情

在quill编辑器中集成秀米和135编辑器

需求

说我们的编辑器太丑了,让添加秀米或者135这种好看的编辑器,好嘛,大工程,不敢怼需求只能开干

因为我们项目里用的是quill的编辑器,秀米官网声明只支持ueditor内核的编辑器。如果项目里用的编辑器不是ueditor内核的,指定要加秀米135的功能,按照这个博主文章一路操作下来,还是很感谢期间博主的解答(该博主github仓库地址:https://github.com/font-size/quill-xiumi-135)

这是做好之后的样子

在这里插入图片描述
接下来的就是我的踩坑路程

1.在vue项目中引用quill集成秀米和135编辑器

1>: 首先自定义一个blot,自定义内容规则,通过走这个blot通道,可以保留样式。

2>修改秀米页面的代码,改成走quill的方法插入。所以在quill项目中暴露出一个能插入代码的方法,绑定到window,在秀米页面里使用这个方法,让秀米的数据通过这个方法插入到quill中。
3:使用elementui的modal弹出框,在里面用iframe加载秀米的html(注意跨域,建议放项目public目录里)

自定义的blot代码,放置于src/utils/blot.js

export default function (Quill) {
  // 引入源码中的BlockEmbed
  const BlockEmbed = Quill.import('blots/block/embed');
  // 定义新的blot类型
  class AppPanelEmbed extends BlockEmbed {
    static create(value) {
      const node = super.create(value);
      // node.setAttribute('contenteditable', 'false');
      // node.setAttribute('width', '100%');
      //   设置自定义html
      node.innerHTML = this.transformValue(value)
      // 返回firstChild,避免被包一层<div class='rich-innerHtml'></div>的无意义标签
      return node.firstChild;
    }

    static transformValue(value) {
      let handleArr = value.split('\n')
      handleArr = handleArr.map(e => e.replace(/^[\s]+/, '')
        .replace(/[\s]+$/, ''))
      return handleArr.join('')
    }

    // 返回节点自身的value值 用于撤销操作
    static value(node) {
      return node.innerHTML
    }
  }
  // blotName
  AppPanelEmbed.blotName = 'AppPanelEmbed';
  // class名将用于匹配blot名称
  AppPanelEmbed.className = 'rich-innerHtml';
  // 标签类型自定义,这玩意还必须加,去掉会报错
  AppPanelEmbed.tagName = 'div';
  Quill.register(AppPanelEmbed, true);
}

2.在使用的文件引入blot.js,在这里我是直接封装了一个quilt的组件,所以直接在这个组件里引入的
在这里插入图片描述

import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';
// 引入自定义blot
import blotSelect from '@/utils/blot'

3.通过自定义blot只完成了一步,即开辟了一个不会被quill过滤的通道,按照博主的指引可以直接去博主的仓库下载这个项目,直接将这两个html拷贝出来,也可以复制下面两段代码(这是已经修正过得代码所以是没有问题的)自己创建页面,把页面放到项目里,我是在public下新建了一个view的文件夹,直接将两个html放进去了。

在这里插入图片描述
135EditorDialogPage.html


<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>135编辑器</title>
  <style>
    html, body {
      padding: 0;
      margin: 0;
    }
    #editor135 {
      position: absolute;
      width: 100%;
      height: 100%;
      border: none;
      box-sizing: border-box;
    }
  </style>
</head>
<body>

<iframe id="editor135" src="//www.135editor.com/simple_editor.html?callback=true&appkey="></iframe>
<!-- <script type="text/javascript" src="internal.js"></script> -->
<script>
  var editor135 = document.getElementById('editor135');
  var parent = window.parent;
  window.onload = function () {
	  setTimeout(function(){
      editor135.contentWindow.postMessage(parent.getHtml(),'*');
	  }, 500);
  };
  document.addEventListener("mousewheel", function (event) {
    event.preventDefault();
    event.stopPropagation();
  });
  window.addEventListener('message', function (event) {
      if (typeof event.data !== 'string') return;
    // console.log(event.data,'我是event')
      parent.setRichText_135(event.data)
      // editor.setContent(event.data);
      // editor.fireEvent("catchRemoteImage");
      // dialog.close();
  }, false);
</script>
</body>
</html>

xiumi-ue-dialog-v5.html


<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>XIUMI connect</title>
    <style>
        html, body {
            padding: 0;
            margin: 0;
        }

        #xiumi {
            position: absolute;
            width: 100%;
            height: 100%;
            border: none;
            box-sizing: border-box;
        }
    </style>
</head>
<body>
<iframe id="xiumi"
        src="//xiumi.us/studio/v5#/paper">
</iframe>
<!-- <script type="text/javascript" src="internal.js"></script> -->
<script>
    var parent = window.parent;
    var xiumi = document.getElementById('xiumi');
    var xiumi_url = window.location.protocol + "//xiumi.us";
    xiumi.onload = function () {
        // console.log("postMessage");
        xiumi.contentWindow.postMessage('ready', xiumi_url);
    };
    document.addEventListener("mousewheel", function (event) {
        event.preventDefault();
        event.stopPropagation();
    });
    window.addEventListener('message', function (event) {
        if (event.origin == xiumi_url) {
            // console.log(event.origin,'event.origin')
            // console.log(xiumi_url,'xiumi_url')
            parent.setRichText_xm(event.data)
            // console.log(event.data,'event.data')
            // editor.execCommand('insertHtml', event.data);
            // dialog.close();
        }
    }, false);
</script>
</body>
</html>

注意:我们手动改,改成quiill接收,并通过我们之前自定义的blot通道插入内容即可。注意这个setRichText方法,到这里数据传输功能已经完成,现在来完善整个流程。

现在我们回到第二步quiltEditor的组件文件,自己来添加按钮控制弹窗的显示与隐藏页面,在加入弹窗模块

在这里插入图片描述
在这里插入图片描述

<!-- 秀米弹窗 -->
    <el-dialog
      :title="title"
      custom-class="xm-dialog"
      width="1200px"
      top="50px"
      :visible.sync="showXiumi"
      :close-on-click-modal="false"
      :modal-append-to-body="false"
      :append-to-body="true"
    >
    <div class="xm-header-l">
      *温馨提示:点击右侧导出插入当前模板内容
    </div>
    <div class="xm-header-r"></div>
      <iframe
        src="/view/xiumi-ue-dialog-v5.html"
        frameborder="0" width="100%"
        sandbox="allow-scripts allow-top-navigation allow-same-origin"
        :height="fullheight+'px'"
        id="xiumiIframe">
      </iframe>
    </el-dialog>

data的变量定义
showXiumi:false,// 秀米编辑器
show135:false,// 135编辑器
selection: {}, // 光标位置

下面是相关js逻辑处理代码

watch: {
    // Watch content change
    value(newVal, oldVal) {
      if (newVal) {
        this.contentValue = newVal;
      } else if (!newVal) {
        this.contentValue = '';
      }
    }
  },
created() {
    this.contentValue = this.value; //value是通过props父级传递到子级的动态数据内容
  },

  mounted() {
    this.editor = this.$refs.myTextEditor.quill; //通过ref得到quill的整个dom
    // console.log(this.value,'__________')
    // console.log(this.editor,'#########')
    // 双向绑定代码 v-model
    this.editor.on('text-change', () => {
        this.emitChange()
        this.selection = this.editor.getSelection()
      })
    // 插入内容
    this.firstSetHtml()
    // 粘贴板监听
    this.listenPaste()

    // 暴露方法绑定到window上,给public\pluging\xiumi-ue-dialog-v5.html使用
    window.setRichText_xm = this.setRichText_xm
    window.setRichText_135 = this.setRichText_135
    // 调用135页面的时候 带入数据 getHtml()
    window.getHtml = this.getHtml
    // console.log(window.getHtml,'window.getHtml')
  },
 // 秀米显示 modal
    showXiumiModel() {
      this.showXiumi = true
    },
    // 135显示 modal
    show135Model() {
      this.show135 = true
    },
    setRichText_135(e) {
      const index = this.selection?this.selection.index: 0
      // console.log('光标位置',index)
      //这个主要是用来处理在135编辑器添加导出到quill再点击135编辑器返回到quill的重复内容
      this.editor.setContents([
        { insert: '', attributes: { bold: true } },
        { insert: '\n' }
      ]);
      this.editor.insertEmbed(index ||  0, 'AppPanelEmbed', e)
      this.show135 = false
    },
    setRichText_xm(e) {
      const index = this.selection?this.selection.index: 0
      // console.log('光标位置',index)
      this.editor.insertEmbed(index ||  0, 'AppPanelEmbed', e)
      this.showXiumi = false
    },
    // 更新text-change
    emitChange() {
      // 获取到quill 根dom中的html
      let html = this.contentValue
      const quill = this.editor
      const text = this.editor.getText()
      if (html === '<p><br></p>') html = ''
      // v-model相关
      this.$emit('input', html)
      this.$emit('change', { html, text, quill })
      // 返回quill中文本长度
      // bug注意:这个方法无法计算秀米代码的中的文字长度!
      this.$emit("getConetntLength", this.editor.getLength())
    },
    // 回显内容时检查秀米代码
    firstSetHtml() {
      // value 为回显内容
      if(this.value) {
        // 判断是否有秀米和或135元素
        if(this.value.indexOf('xiumi.us') > -1 || this.value.indexOf('135editor.com') > -1 ) {
          const originNode =  new DOMParser().parseFromString(this.value,'text/html').body.childNodes
          this.nodesInQuill(originNode)
        }
      }
    },
    // 根据node类型分发处理
    nodesInQuill(originNode) {
      for(let i = originNode.length - 1; i >= 0; i --) {
        if(originNode[i].localName === 'section') {
          // 秀米类型代码,走新blot
          this.setRichText_xm(originNode[i].outerHTML, 0)
          this.setRichText_135(originNode[i].outerHTML, 0)
        } else {
          // 正常插入
          this.editor.clipboard.dangerouslyPasteHTML(0, originNode[i].outerHTML)
        }
      }
    },
    // 监听粘贴板
    listenPaste() {
        this.editor.root.addEventListener('paste', (e) => {
          const msg = (e.clipboardData || window.clipboardData).getData('text/html') // 获取粘贴板文本
          if(msg) {
            if(msg.indexOf("xiumi.us") > -1 || msg.indexOf("_135editor") > -1) {
              const value = new DOMParser().parseFromString(msg,'text/html').body.childNodes // 获取nodes
              // console.log(value)
              e.preventDefault() // 阻止复制动作
              e.stopPropagation()// 阻止冒泡
              this.nodesInQuill(value) // 根据不同标签,使用不同的插入方法
            }
          }
        })
    },
    // 获取html内容
    getHtml() {
      // console.log('富文本',this.contentValue )
      return this.contentValue
    }
到这里就结束了看效果

秀米编辑器:编辑好后点击导出便可导出到quill编辑器中,也可在quill编辑器中输入同步到秀米中
在这里插入图片描述
在这里插入图片描述
135编辑器:编辑好后点击完成编辑便可导出到quill编辑器中,也可在quill编辑器中输入同步到135中在这里插入图片描述在这里插入图片描述

vue项目百度ueditor编辑器集成135和秀米,主题图标美化 vue项目百度ueditor编辑器集成135和秀米,ueditor编辑器接入135和秀米,富文本编辑器接入135,富文本编辑器接入秀米,vue接入135编辑器,vue接入秀米编辑器,ueditor百度编辑器集成vue,Ueditor接入秀米,Ueditor接入135,Ueditor 135 秀米,Ueditor添加菜单栏入口,Ueditor整合135/秀米,富文本编辑器集成 阅读详情

相关推荐

UEditor 集成秀米的几个文件

UEditor集成秀米需要的文件,由于有几个比较难找,把几个文件打包供大家下载。

Quill 编辑器使用记录(一)

配置(configuration) · Quill官方中文文档 · 看云 (kancloud.cn)Quill是一个跨平台的功能强大的富文本编辑器。开发者可以通过简单的API来控制编辑器的内容。3、如果全局使用你就全局导入,如果组件使用就下组件内导入,我是组件内导入。使用场景:在线协同编辑,技术栈 laravel9+vue3。5、然后 运行 npm run dev。4、设置编辑器样式和实例化编辑器。

itsima 2629

vue+elementUI+quill编辑器+135编辑器集成+秀米集成

使用说明: 1、下载软件包 2、把pluging文件夹拷贝到vue的静态文件夹下面(static或public) 3、把quill(子)文件夹拷贝到组件列表里面 4、通过组件的方式应用该编辑器

vue+elementui+quill富文本框+秀米编辑器和135编辑器

vue+elementui+quill富文本框+秀米编辑器和135编辑器

ccsundhine的博客 3499

EWM与SAP ERP的数据集成

1、EWM与 SAPERP的无缝集成-基础数据&业务交易数据 2、SAP ERP设置:连接SAP ERP和EWM必须设置应用程序连接支持-ALE(Application Link Enabling) 3、ERP - EWM仓库数据集成: SAP ERP需要设置配置信息,连接ERP和EWM之间的库存管理应用,基于工厂+库存地点对应一个仓库号来进行配置; 在ERP中需要创建一个中间虚拟仓库,代表ERP仓库;“中间虚拟”仓库创建之后,工厂+库存地点的信息...

weixin_43899798的博客 3812

Marvell车载以太网交换机芯片88Q5050

Marvell推出了四款车载用交换机芯片,88Q5050,88Q5050, 88Q5072和88Q6113。其中88Q5030有5 Port用于通信,88Q5050有8 Port用于通信,5072与6113有11 Port用于通信。由于项目中用到了88Q5050,所以本文中只涉及到88Q5050的内容。本文是对使用88Q5050的梳理和总结。

zhuwade的博客 2万+

【经验】秀米排版指南|特殊布局(如文字环绕图片等无法使用秀米基本布局组合出来的布局)

修改HTML代码,从而修改秀米布局。

shandianchengzi的博客 1万+

把STM32MP135当单片机玩:实战SD卡脱机运行LED程序(基于MP135DK开发板)

本文详细介绍了如何在STM32MP135开发板上实现SD卡脱机运行LED程序,通过裸机开发方式(Bare Metal)利用HAL库完成GPIO控制,并解析了SD卡启动流程。内容涵盖工程创建、代码编写、SD卡烧录及常见问题排查,为开发者提供了一种高性能单片机开发方案。

weixin_33734785的博客 248

第三方网站接入秀米,实现秀米编辑的文章同步到自己的网站平台

第三方网站接入秀米,实现秀米编辑的文章同步到自己的网站平台 公司官网,要实现在官网上编辑新闻同步到微信公众号上。秀米能够同步文章到公众号,且排版资源丰富。秀米官网提供了第三方接入的方法(具体参照秀米官网http://r.xiumi.us/board/v5/2a5va/16516964)。但是按照方法二流程,出现了一些问题。现记录如下: 1.示例中第2点文件所放置的目录 下载文件h

never never land 1万+

windows sever2019切换Linux内核

安装docker engine后,内核是windows,很多镜像都无法安装使用。 一,在https://github.com/linuxkit/lcow/release 下载最新版本release.zip,我使用了如下版本。 二,新建文件夹C:\Program Files\Linux Containers ,把release.zip(不要解压)放入此文件夹 三,编辑docker配置文件( C:\ProgramData\docker\config\daemon.json) ,电脑中没有该文件,新建一

记录日常疑问 3884

Python之afdx包语法、参数和实际应用案例

Python 的 afdx 包是针对 AFDX 协议的轻量级开发工具,专注于 AFDX 数据帧的解析、构造、发送/接收、协议合规性校验等核心能力,广泛应用于航空电子设备测试、仿真、数据监控等场景。

王国平的博客 991

ngx-quill主题定制:从Snow到Bubble的完全自定义指南

ngx-quill是一个强大的Angular富文本编辑器组件库,它为开发者提供了丰富的主题定制功能。无论你是刚接触ngx-quill的新手,还是希望深度定制编辑器外观的开发者,这篇终极指南都将带你从默认的Snow主题到Bubble主题,再到完全自定义主题的完整旅程。🎨 ## 为什么需要定制ngx-quill主题? 在现代化的Web应用中,编辑器的外观和体验直接影响用户的使用感受。ngx-qu

gitblog_00751的博客 781

RK3568平台开发系列讲解:Linux wifi的调试

查询结果中state为ENABLE,表示hostapd程序启用成功。首先查看设备是否存在。

内核笔记 177

2020-03-20 QuillEditor编辑器疑难杂症汇总

image.png Quill 是一个让人又爱又恨的可见即所得富文本编辑器,尽管它的常规功能不如tinyMCE那么完善,界面也不如国产的wangEditor,使用上的坑也比较多。但它的定制性很强大,它的不足几乎都可以通过DIY方式来弥补,本文主要是针对QuillEditor在使用上碰到的问题进行了一些汇总,将会持续更新。 问题1. 粘贴后光标会自动弹到文档的初始位置。...

♀我爱摇滚,更爱金属乐♀ 1898

**YOLOv11性能突破:基于YOLOv10-PSA注意力机制的目标检测革命性升级**

购买即可解锁300+YOLO优化文章,并且还有海量深度学习复现项目,价格仅需两杯奶茶的钱,别人有的本专栏也有!

m0_71589036的博客 205

SAPGUI 与 ADT 的时代分野:在多云架构下,谁还能代表现代 SAP 开发

摘要(149字) SAP开发工具正经历代际更迭:SAPGUI基于专有协议(NI/DIAG)的厚客户端架构难以适配多云环境,而ADT(ABAP Development Tools)通过HTTP(S)协议和Eclipse生态成为ABAP Cloud/RAP开发的唯一入口。关键差异体现在:ADT支持CDS、行为定义等云原生对象建模,天然对齐BTP的零信任网络;集成ATC、Git等DevOps工具链;而SAPGUI无法创建RAP核心对象,在跨平台、自动化方面存在硬限制。官方文档明确将ADT作为Clean Core战

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 405

Quill富文本编辑器HTML导出功能存在XSS漏洞分析

npmquill= 2.0.3无Quill 的 HTML 导出功能中存在数据验证缺失漏洞,可导致跨站脚本(XSS)攻击。此问题影响 Quill 版本:2.0.3。

分享技术点滴 478

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

UEDITOR编辑器粘贴WORD图片无法显示的问题

要求:开源,免费,技术支持编辑器:百度ueditor前端:vue2,vue3,vue-cli,react,html5需求:复制粘贴word内容图片,word图片转存交互,导入pdf,导入PowerPoint(PPT),web截屏用户体验:Ctrl+V快捷键操作平台:Windows,macOS,Linux,RedHat,CentOS,Ubuntu,中标麒麟,银河麒麟,统信UOS,信创国产化系统。

alisky119的博客 1049

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

task:在 markdown、富文本编辑框内的文章图片转发到其他平台,出现图片丢失的解决办法

跨平台文章发布时图片丢失问题的解决方案:针对不同平台图床限制导致的图片嵌入失败,提出"统一可信图床中转"策略。方案包括手动批量上传至目标平台白名单图床,或通过编辑器(如wangEditor/TinyMCE/Quill)配置OSS图床实现自动上传转换。重点推荐wangEditor,因其简单易用、支持Word粘贴自动上传且中文文档完善,是解决跨平台图片同步的最佳选择。核心实现需完成OSS接口配置、粘贴事件拦截、图片数据提取及链接替换等步骤。

这里是 AI 食用指南,持续分享有用的AI 实操和应用! 731

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

处理一些数据

fn1 . call(this) //可以更改this指向 // fn1()或者直接调用 } var fn1 = debounce(function() {console . log(111111) //这里也可以写ajax请求 } , 1000) //防抖函数封装 function debounce(fun , wait) {

weixin_51109349的博客 1589

Qwen3-VL进阶指南:ComfyUI自定义文本编码器扩展开发完全手册(含API要点)

📦 **Qwen3-VL** 是官方为 **ComfyUI** 重打包的文本编码器(Text Encoder)模型包,基于 Qwen3-VL-4B / 8B-Instruct,一次提供 **7 个量化版本**,覆盖 bf16、fp8、int8、w4a8、nvfp4 等精度,让你按显存大小自由选型。本文带你完成从下载、选型到 API 调用的完整流程。 --- ## 一、这个仓库是什么?一文看懂

gitblog_00742的博客 659

Claude Max订阅跑OpenCode有风险吗?opencode-with-claude安全边界与合规风险解读

opencode-with-claude 是一个 OpenCode 插件,让你直接用自己的 Claude Max 订阅驱动 OpenCode:启动 OpenCode 时,插件会在本机自动拉起一个本地代理(基于 Meridian),退出时自动销毁,无需单独管理 Docker 容器或代理进程。很多用户关心:**把付费订阅接进第三方编码工具,安全边界在哪?会不会违反 Anthropic 的服务条款?**

gitblog_00406的博客 1009

OpenHarmony平台Flutter三方库适配情况

本文档汇总了OpenHarmony平台适配的三方库情况,包括已适配的三方库、已适配的纯dart库以及正在适配中的三方库。这些库覆盖了权限管理、UI组件、设备信息、位置服务、媒体处理等多个功能领域,为开发者提供了丰富的选择。

OH_TPC的博客 1040

VUE项目中引入135编辑器

**【前言】前人栽树,后人乘凉 ** 由于之前做过这个功能,但是没有记录,这次再一次开发的时候忘了几步操作,花了半天时间又一次实现,充分知道了好记性不如烂笔头,记录一下分享给大家 ==|具体效果如图 |==百度编辑器嵌套135编辑器/秀米编辑器===| 【上手第一步】 1.百度编辑器官网下载ueditor的文件压缩包 {这里吐槽一下,这玩意百度都不怎么维护了} 【上手第二步】 2.项目目录文件public文件夹存放以下文件:文件结构如下 ...

菜鸟老五 2576

quill 富文本编辑器常见问题汇总

最近项目里用到了这个quill 富文本编辑器,网上一看,woc骂声一片。其实我觉得是中文的翻译,以及介绍不够详尽导致的,其实这个富文本编辑器还是很友善的。 官方github地址:https://github.com/quilljs/quill 官方文档:https://quilljs.com/docs/quickstart/ 关于插入表格 如果你需要拥有插入表格的功能, 你要确保你用的是quill而不是vue-quill-editor。 这是由于 quill 在2.0版本之后才对外提供了getModu

weixin_44067399的博客 7323
上一篇: 时间格式在ios和安卓兼容性的问题
下一篇: elementUI 动态增减表单并非空验证
沐子凡
博客等级 码龄9年 24粉丝 43原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值