jquery-easyUI第二篇【综合案例】

基于easyUI开发的一个综合案例模版


<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>练习</title>

    <!-- 引入css文件,不限顺序 -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/themes/default/easyui.css" type="text/css"></link>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/themes/icon.css" type="text/css"></link>

    <!-- 引入js文件,有顺序限制 -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>

  </head>
  <body>

        <!-- Layout布局 -->
        <div id="layoutID" style="width:700px;height:500px" class="easyui-layout" data-options="fit:true">

            <!-- 北 -->
            <div data-options="region:'north',border:true,iconCls:'icon-remove',collapsible:true" style="height:100px;">
                <center><font style="font-size:66px">jQuery-EasyUI组件</font></center>            
            </div>   

            <!-- 南 -->
            <div data-options="region:'south'" style="height:100px;">
                <center><font style="font-size:33px">XX公司版权所有</font></center>           
            </div>   

            <!-- 东 -->
            <div data-options="region:'east',iconCls:'icon-reload'" style="width:100px;"></div>   

            <!-- 西 -->
            <div data-options="region:'west'" style="width:200px;">
                <!-- Accordion分类 -->
                <div 
                    id="accordionID" 
                    class="easyui-accordion" 
                    data-options="fit:true,border:false,selected:-1" 
                    style="width:300px;height:400px;">   
                    <div title="部门管理" data-options="iconCls:'icon-save'" style="padding:10px;">   
                        <!-- Linkbutton按钮 -->
                        <a 
                            id="btn_add" 
                            href="#" 
                            class="easyui-linkbutton" 
                            data-options="iconCls:'icon-add'">增加部门</a><p> 
                        <a 
                            id="btn_find" 
                            href="#" 
                            class="easyui-linkbutton" 
                            data-options="iconCls:'icon-search'">查询部门</a><p> 
                        <a 
                            id="btn_update" 
                            href="#" 
                            class="easyui-linkbutton" 
                            data-options="iconCls:'icon-edit'">修改部门</a><p> 
                        <a 
                            id="btn_delete" 
                            href="#" 
                            class="easyui-linkbutton" 
                            data-options="iconCls:'icon-remove'">删除部门</a><p>  
                    </div>   
                    <div title="人事管理" data-options="iconCls:'icon-reload'" style="padding:10px;">   
                        <!-- tree树 -->              
                        <ul id="treeID" class="easyui-tree" data-options="lines:true">   
                           <li>
                                <span>增加人事</span>
                           </li>
                           <li>
                                <span>查询人事</span>
                                <ul>
                                    <li>
                                        <span>分页查询人事</span>
                                        <ul>
                                            <li>
                                                <span>模糊分页查询人事</span>
                                            </li>
                                            <li>
                                                <span>精确分页查询人事</span>
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <span>查询所有人事</span>
                                    </li>
                                </ul>
                           </li>
                        </ul>
                    </div>   
                    <div title="客户管理" data-options="iconCls:'icon-reload'" style="padding:10px;">   
                        客户管理    
                    </div> 
                    <div title="权限管理" data-options="iconCls:'icon-reload'" style="padding:10px;">   
                        权限管理    
                    </div>
                    <div title="报表管理" data-options="iconCls:'icon-print'" style="padding:10px;">   
                        报表管理    
                    </div> 
                    <div title="帮助" data-options="iconCls:'icon-help'" style="padding:10px;">   
                        帮助    
                    </div>  
                </div>
            </div>   

            <!-- 中 -->
            <div data-options="region:'center'" style="padding:5px;background:#eee;">
                <!-- Tabs选项卡 -->
                <div 
                    id="tabsID" 
                    class="easyui-tabs" 
                    style="width:500px;height:250px;"
                    data-options="plain:true,border:false,selected:-1,fit:true">   
                </div>
            </div>   

        </div>

        <script type="text/javascript">
            //定位4个按钮
            $("a").click(function(){
                //获取你所单击的按钮的标题
                var title = $(this).text();
                //去空格
                title = $.trim(title);
                //如果title变量是"增加部门"
                if("增加部门" == title){
                    //查看该选项卡是否已经打开
                    var flag = $("#tabsID").tabs("exists",title);
                    //如果未打开
                    if(!flag){
                        //打开选项卡
                        $("#tabsID").tabs("add",{
                            "title" : title,
                            "closable" : true,
                            "content" : "文本",
                            "iconCls" : "icon-add"
                        });
                    }
                }else if("查询部门" == title){
                    var flag = $("#tabsID").tabs("exists",title);
                    if(!flag){
                        //打开选项卡
                        $("#tabsID").tabs("add",{
                            "title" : title,
                            "closable" : true,
                            "content" : "文本",
                            "iconCls" : "icon-search"
                        });
                    }
                }
            });
        </script>
        <script type="text/javascript">
            $(function(){
                //收起所有的选项
                $("#treeID").tree("collapseAll");
            });
        </script>
        <script type="text/javascript">
            $("#treeID").tree({
                onClick : function(node){
                    //获取点击树节点的文本
                    var title = node.text;
                    //去空格
                    title = $.trim(title);
                    //产生tab选项卡
                    var flag = $("#tabsID").tabs("exists",title);
                    //如果没有打开的话
                    if(!flag){
                        //打开选项卡
                        $("#tabsID").tabs("add",{
                            "title" : title,
                            "closable" : true,
                            "href" : "${pageContext.request.contextPath}/empList.jsp",
                            "iconCls" : "icon-search"
                        });
                    }   
                }
            });
        </script>

  </body>
</html>

效果:

这里写图片描述

这里写图片描述


分页

相信我们的分页已经做得不少了,这次我们使用easyUI+Oracle+jdbc来做一个分页…【之前大都都用Mysql,这次用Oracle】

DateGrid会异步以POST方式向服务器传入二个参数:page和rows二个参数,服务端需要哪个,就接收哪个参数

  • page:需要显示的页号
  • rows:需要获取多少条记录

编写emp实体


package zhongfucheng.entity;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by ozc on 2017/7/17.
 */
public class Emp implements Serializable {

    private Integer empno;
    private String ename;
    private String job;
    private Integer mgr;
    private Date hiredate;
    private Integer sal;
    private Integer comm;
    private Integer deptno;

    public Emp() {
    }

    public Emp(Integer empno, String ename, String job, Integer mgr, Date hiredate, Integer sal, Integer comm, Integer deptno) {
        this.empno = empno;
        this.ename = ename;
        this.job = job;
        this.mgr = mgr;
        this.hiredate = hiredate;
        this.sal = sal;
        this.comm = comm;
        this.deptno = deptno;
    }

    public Integer getEmpno() {
        return empno;
    }

    public void setEmpno(Integer empno) {
        this.empno = empno;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public Integer getMgr() {
        return mgr;
    }

    public void setMgr(Integer mgr) {
        this.mgr = mgr;
    }

    public Date getHiredate() {
        return hiredate;
    }

    public void setHiredate(Date hiredate) {
        this.hiredate = hiredate;
    }

    public Integer getSal() {
        return sal;
    }

    public void setSal(Integer sal) {
        this.sal = sal;
    }

    public Integer getComm() {
        return comm;
    }

    public void setComm(Integer comm) {
        this.comm = comm;
    }

    public Integer getDeptno() {
        return deptno;
    }

    public void setDeptno(Integer deptno) {
        this.deptno = deptno;
    }
}

编写EmpDao

使用Oracle的语法来实现分页…!


public class EmpDao {
    public  int getPageRecord() throws SQLException {
        QueryRunner queryRunner = new QueryRunner(JDBCUtils.getDataSource());
        String sql = "SELECT COUNT(EMPNO) FROM EMP";
        String count = queryRunner.query(sql, new ScalarHandler()).toString();
        return Integer.parseInt(count);
    }
    public  List<Emp> getList(int start, int end) throws SQLException {
        QueryRunner queryRunner = new QueryRunner(JDBCUtils.getDataSource());

        String sql = "SELECT *FROM (SELECT rownum rownumid,emp.* FROM emp WHERE rownum <= ?) xx WHERE xx.rownumid> ?";

        List<Emp> list = (List<Emp>) queryRunner.query(sql, new Object[]{end, start}, new BeanListHandler(Emp.class));
        return list;
    }
}

编写EmpService

得到对应的分页数据,封装到分页对象中!


public class EmpService {


    private EmpDao empDao = new EmpDao();
    public Page getPageResult(int currentPage) throws Exception {

        Page page = new Page(currentPage, empDao.getPageRecord());
        List<Emp> empList = empDao.getList(page.getStartIndex(), page.getLinesize() * currentPage);
        page.setList(empList);
        return page;
    }

}

处理请求的Servlet

接收page参数,如果为空,就设置为1

把得到的分页数据封装成datagrid要的格式,返回给浏览器!

    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {

        try {
            //调用service
            EmpService empService = new EmpService();

            //设置编号方式
            request.setCharacterEncoding("UTF-8");

        /*获取客户端传递进来的参数,easyUI使用的是page参数*/
            String pageStart = request.getParameter("page");

            if (pageStart == null || pageStart.length() == 0) {
                pageStart = "1";
            }
            int currentPage = Integer.parseInt(pageStart);
            Page pageResult = empService.getPageResult(currentPage);

            Map map = new HashMap();

            map.put("total", pageResult.getTotalRecord());
            map.put("rows", pageResult.getList());


            //使用第三方工具将map转成json文本
            JSONArray jsonArray = JSONArray.fromObject(map);
            String jsonJAVA = jsonArray.toString();

            //去掉二边的空格
            jsonJAVA = jsonJAVA.substring(1,jsonJAVA.length()-1);
            System.out.println("jsonJAVA=" + jsonJAVA);

            //以字符流的方式,将json字符串输出到客户端
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter pw = response.getWriter();
            pw.write(jsonJAVA);
            pw.flush();
            pw.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

JSP页面显示


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>

    <title>dataGrid+分页</title>
    <link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
    <script type="text/javascript" src="easyui/jquery.min.js"></script>
    <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
  </head>
  <body>

  <table id="dg" style="width: 800px" ></table>
  <script>
    $('#dg').datagrid({
      url:'${pageContext.request.contextPath}/getPageServlet?time'+ new Date().getTime(),
      columns:[[

        /*这里的field要对应JavaBean的属性名称,否则获取不到数据*/
        {field:'empno',title:'编号',width:100},
        {field:'ename',title:'姓名',width:100},
        {field:'job',title:'工作',width:100},
        {field:'mgr',title:'上编',width:100},
        {field:'hiredate',title:'入时',width:100},
        {field:'sal',title:'月薪',width:100},
        {field:'comm',title:'佣金',width:100},
        {field:'deptno',title:'部编',width:100}
      ]],
      fitColumns : true,
      singleSelect : true,
      pagination : true,

        /*pageSize对应rows,pageNum对应page,datagrid会自动把这两个值传递进去*/
      pageNumber : 1,
      pageSize : 3,
      pageList : [3],
      fit:true
    });
  </script>

  </body>
</html>

效果:

这里写图片描述


<script type="text/javascript"> $(function () { $('pre.prettyprint code').each(function () { var lines = $(this).text().split('\n').length; var $numbering = $('<ul/>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('<li/>').text(i)); }; $numbering.fadeIn(1700); }); }); </script>
【Jquery easyui 】Jquery easyui tree的使用 这个ui用的一切都是json数据。树也是如此!后台需要返回与格式匹配的json数据才能正确加载树。页面定义一个ui:[html] view plain copy&lt;ul id="messageInfoAddTree" class="easyui-tree" checkbox="true" data-options="lines:true" style="height:94%"&gt;&am 阅读详情

相关推荐

基于jQuery EasyUI的综合Web门户案例

jQuery是目前最流行的JavaScript库之一,它简化了HTML文档遍历和操作、事件处理、动画和Ajax交互,极大地提高了开发效率。通过其简洁的语法和丰富的API,jQuery使得前端开发人员能够以更加直观和高效的方式编写代码。EasyUI是一个基于jQuery的前端框架,专注于提供可扩展的UI组件。它包含了一系列现成的组件,这些组件使得开发者能够快速地搭建起美观且一致的用户界面。组件种类广泛,涵盖了常见的界面需求,如数据表格、面板、按钮、对话框、菜单、树状结构等。

weixin_42393362的博客 1146

JQueryEasyUI 组件的实例化

1、 组件实例化方式有两种 通过class属性实例化组件。 通过javascript代码实例化组件。   需要先引用   提示: 下面的方法不能同时使用 会发生错误 1、通过class属性实例化组件编码规则 通过特定的HTML标签,添加class属性和data

寂寞的一只狗的博客 1145

深入探索jQuery EasyUI 1.4.3的奇葩案例与实践

jQuery EasyUI是一款基于jQuery框架开发的前端UI库。其核心是将常用的界面组件以插件形式组织起来,提供易于使用的API,使得开发者能够快速创建交云和响应式的用户界面。它旨在帮助开发者避免复杂的CSS和JavaScript编程,通过简单配置即可获得丰富的界面组件。事件委托允许在父元素上绑定事件处理器,由子元素的事件触发。示例代码:// 在父容器上委托事件给子元素 '.myClass'console.log('子元素被点击');});

weixin_34535286的博客 996

jQuery EasyUI window窗口实例

<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>jQuery EasyUI window窗口</title> <link rel="stylesheet" id="easyuiTheme" type="text/css" hre...

weixin_30726161的博客 263

五套easyUI模板

有easyui绿色后台管理系统+H5手机界面,easyUI数字管理系统,easyUi信息考核系统,easyUI云平台四套模板

Frida+Objection保姆级教程:从环境搭建到实战Hook(含Wallbreaker插件使用)

本文提供了一份从零开始的Frida与Objection移动安全动态分析实战指南。详细讲解了Python环境配置、Frida-Server部署、Objection核心命令使用以及Wallbreaker插件安装与应用。通过实战案例演示如何Hook网络请求(如HttpURLConnection和OkHttp3),帮助安全研究人员快速掌握应用运行时行为分析与漏洞挖掘技能。

weixin_28318011的博客 109

使用Jquery+EasyUI 进行框架项目开发案例讲解

使用Jquery+EasyUI 进行框架项目开发案例讲解之四 组织机构管理源码分享      在上三篇文章    《使用Jquery+EasyUI进行框架项目开发案例讲解之一---员工管理源码分享》    《使用Jquery+EasyUI 进行框架项目开发案例讲解之二---用户管理源码分享》   《使用Jquery+EasyUI 进行框架项目开发案例讲解之三-

逍遥飞鹤的专栏 5519

echarts实现3D地图——map3D

【代码】echarts实现3D地图——map3D。

xiaoququ的博客 7337

EasyUI入门以及实例

一,EasyUI 简介 easyui是一种基于jQuery的用户界面插件集合。 easyui为创建现代化,互动,JavaScript应用程序,提供必要的功能。 使用easyui你不需要写很多代码,你只需要通过编写一些简单HTML标记,就可以定义用户界面。 easyui是个完美支持HTML5网页的完整框架。 easyui节省您网页开发的时间和规模。 easyui很简单但功能强大的。 ...

weixin_43689040的博客 301

STM32F407实现LwIP的MQTT客户端并连接到服务器

这个是用LwIP协议栈中自带的MQTT客户端API写成的,代码注释很详细,附带有服务端的展示。LwIP版本是2.1.2.

wait_for_STM32的博客 6405

Ubuntu20.04系统Cuckoo sandbox所需环境搭建及安装(超详细图文)

请勿叫我大神,我只是互联网的搬运工~ 前言 本教程以Ubuntu20桌面版作为示范,服务器版同样适用,但可能稍微麻烦一点,服务器版本的话安装Xmanage套装使用可能会相对轻松一些,由于后面会使用到vbox的使用,对vbox命令行操作不熟悉的小伙伴用xmanage可能会相对轻松一点。 提示:以下是本篇文章正文内容,下面案例可供参考 安装ubuntu20桌面版 步骤1:转到https://ubuntu.com/download/desktop下载下载.iso。 步骤2:使用您选择的虚拟机监控程序(VMWa

ElsonHY的博客 1万+

JQuery EasyUI 案例加使用

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33717117的博客 205

Unity URP风格化水面Shader全流程实现与性能优化指南

在游戏开发中,Shader是实现特定视觉风格的核心技术,它通过编写在GPU上运行的程序,控制模型每个像素的最终颜色与光照表现。其原理在于对顶点位置、纹理坐标、光照信息及深度等数据进行一系列数学运算与插值。这项技术的价值在于能够以极高的自由度创造从写实到卡通的各种渲染效果,同时通过算法优化实现对硬件资源的精准控制。在移动游戏、独立游戏等对性能与风格化有强烈需求的场景中,自定义Shader尤为重要。本文聚焦于使用Unity URP渲染管线,从零构建一个高效的风格化水面Shader,详细拆解了深度色、波浪动画、边

weixin_34320724的博客 376

jquery easyUI第二篇【综合案例】

tags: web前端库 基于easyUI开发的一个综合案例模版 &lt;%@ page language="java" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &a

weixin_34415923的博客 157

OpenClaw第2章:快速安装

本章将手把手教你安装 OpenClaw。

Maynor的博客 3245

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

jQuery EasyUI 理论

jQuery EasyUI 是一组基于 jQuery 的 UI 插件集合,用于快速构建现代化的 Web 界面。它提供了丰富的组件(如表格、表单、对话框、树形菜单等),支持拖放、排序、分页等功能,适合开发企业管理后台或数据密集型应用。

weixin_62524633的博客 1658

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

EasyUI学习

一、

Yuncoco的博客 916

深度学习工具包 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")

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

jquery EasyUI(一)

这是我第一天学习jquery EasyUI。我发现我都是零碎地学习后才去系统地去学习的,哈哈,不知道有没有跟我一样的博友。接触jquery EasyUI还是在做ASP.NET综合实验的时候,我准备用MVC去做,然后就用到了jquery EasyUI。第一印象:高端大气上档次,编写一个前端页面速度极快,超级爱。开始学习了。http://www.jeasyui.net/我是在中文网里学习的,下面全手打...

飞鸿的博客 2931

jQuery及EasyUI学习心得

在VS2010中,如果不能智能提醒,就先要确保JS文件被引入,然后再多次点击“编辑”》》“IntelliSense"》》更新JS。 一、JQUERY部分: 1、在中,如果是需要页面打开就要载入的,需要先写: $(function(){ }); 然后把需要变成EasyUI的input或div等的ID写入其中,否则他们不能变成你想要的插件。当然,其他的函数,如onclick(),就要写到

阿龙的专栏 4170

jQuery EasyUI parser

jQuery EasyUI parser 的使用场景 parser,故名意思,就是解析器的意思,别看他只有那么几行代码,jQuery Easyui 能够根据class就能正常渲染页面全靠它了。一般情况下,我们并用不到解析器,本文主要讨论一下,什么情况下会用到它,如何使用。 自动调用parser: 我们之所以在页面中,只要书写相应的class,Easyu

Developer of XingKong22star 4861

基于jQuery的jQuery-easyUI下载和使用

一.下载easyUI    下载地址: http://www.jeasyui.com/download/index.php    下载--解压--打开文件目录如图:    二.使用easyUI    一个小demo,只是展示easyUI的链接按钮样式:&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8...

hero_hope的博客 2770

jQuery EasyUI 教程

摘要: jQuery EasyUI 是基于 jQuery 的前端 UI 框架,提供数据网格、树形菜单、表单等丰富组件,支持快速开发跨平台应用。推荐中文资源包括菜鸟教程(基础示例)、W3Cschool(实战指南)和 EasyUI 中文网(官方文档)。通过 CDN 引入库后,可直接用 HTML 类创建组件(如窗口、数据网格),无需复杂 JS 代码。其标记式开发模式简化了交互实现,适合初学者和快速项目构建。如需具体组件(如 DataGrid CRUD)教程,可进一步提供需求细节。

likuolei的博客 918
上一篇: java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector
下一篇: SpringMVC第一篇【介绍、入门、工作流程、控制器】
Java3y
Java3y 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄9年 1万+粉丝 509原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值