精进不休 .NET 4.0 (1) - asp.net 4.0 新特性之web.config的改进, ViewStateMode, ClientIDMode, EnablePersistedSelection, 控件的其它一些改进

STM32实战:AD7606并行接口配置全攻略(附代码避坑指南) 本文详细介绍了STM32与AD7606并行接口的配置方法,包括硬件连接、时序配置、状态机驱动设计及性能优化。通过实战代码和避坑指南,帮助开发者高效实现16位8通道同步采样ADC的数据采集,提升工业应用中的信号处理能力。 阅读详情
[源码下载]


精进不休 .NET 4.0 (1) - asp.net 4.0 新特性之web.config的改进, ViewStateMode, ClientIDMode, EnablePersistedSelection, 控件的其它一些改进


作者: webabcd


介绍
asp.net 4.0 的新增功能
  • 简洁的 web.config 文件
  • 控件的新属性 ViewStateMode - 控件的视图状态模式
  • 控件的新属性 ClientIDMode - 生成客户端 ID 的方式
  • 列表控件的新属性 EnablePersistedSelection - 保存选中项的方式
  • 控件的其他一些增强点
    • RenderOuterTable - 指定控件在客户端呈现的时候,是否在外层加 table 标签
    • Menu 控件,在 asp.net 4.0 中将会以 ul li 的方式呈现在客户端
    • RepeatLayout - 布局模式,控件在客户端的 HTML 呈现方式
    • Wizard 和 CreateUserWizard 新增了 LayoutTemplate 模板
    • 原来使用 ListView 必须要有 LayoutTemplate ,在 asp.net 4.0 中可以不再用它了


示例
1、简洁的 web.config,配置信息被移到了 machine.config
Web.config
代码
<? xml version="1.0" ?>

<!--
    清爽的 web.config 
    配置信息一律都放到 machine.config 里了
-->

< configuration >
    
    
< system.web >
        
< compilation  debug ="true"  targetFramework ="4.0"   />
    
</ system.web >
    
</ configuration >


2、ViewStateMode 属性的用法
ViewStateDemo.aspx
代码
<% @ Page Title = ""  Language = " C# "  MasterPageFile = " ~/Site.Master "  AutoEventWireup = " true "
    CodeBehind
= " ViewStateDemo.aspx.cs "  Inherits = " AspDotNet.ViewStateDemo "   %>

< asp:Content  ID ="Content1"  ContentPlaceHolderID ="head"  runat ="server" >
</ asp:Content >
< asp:Content  ID ="Content2"  ContentPlaceHolderID ="ContentPlaceHolder1"  runat ="server" >
    
<!--
        ViewStateMode - 控件的视图状态模式
            ViewStateMode.Enabled - 此控件启用 ViewState,并且其子控件中所有 ViewStateMode 为 Inherit 的控件也全部启用 ViewState
            ViewStateMode.Disabled - 此控件禁用 ViewState,并且其子控件中所有 ViewStateMode 为 Inherit 的控件也全部奇偶能用 ViewState
            ViewStateMode.Inherit - 此控件是否启用 ViewState,由其父控件的 ViewStateMode 的值决定
    
-->

    
< asp:PlaceHolder  ID ="PlaceHolder1"  runat ="server"  ViewStateMode ="Disabled" >

        
<!-- 无 ViewState -->
        
< asp:Label  ID ="Label1"  runat ="server"  ViewStateMode ="Disabled"   />

        
< br  />

        
<!-- 有 ViewState -->
        
< asp:Label  ID ="Label2"  runat ="server"  ViewStateMode ="Enabled"   />

        
< br  />

        
<!-- 无 ViewState -->
        
< asp:Label  ID ="Label3"  runat ="server"  ViewStateMode ="Inherit"   />

    
</ asp:PlaceHolder >

    
< br  />
    
<!-- 点击“回发”按钮后观察各个 Label 控件是否启用了 ViewState -->
    
< asp:Button  ID ="Button1"  runat ="server"  Text ="回发"   />
</ asp:Content >

ViewStateDemo.aspx.cs
代码
using  System;
using  System.Collections.Generic;
using  System.Linq;
using  System.Web;
using  System.Web.UI;
using  System.Web.UI.WebControls;

namespace  AspDotNet
{
    
public   partial   class  ViewStateDemo : System.Web.UI.Page
    {
        
protected   void  Page_Load( object  sender, EventArgs e)
        {
            
//  页面第一次加载时,分别给三个 Label 赋值,用于演示是否启用了 ViewState
             if  ( ! Page.IsPostBack)
            {
                Label1.Text 
=   " Label1 " ;
                Label2.Text 
=   " Label2 " ;
                Label3.Text 
=   " Label3 " ;
            }
        }
    }
}


3、ClientIDMode 属性的用法
ClientID.aspx
代码
<% @ Page Title = " ClientID "  Language = " C# "  MasterPageFile = " ~/Site.Master "  AutoEventWireup = " true "
    CodeBehind
= " ClientID.aspx.cs "  Inherits = " AspDotNet.ClientID "  ClientIDMode = " Static "   %>

< asp:Content  ID ="Content1"  ContentPlaceHolderID ="head"  runat ="server" >
</ asp:Content >
< asp:Content  ID ="Content2"  ContentPlaceHolderID ="ContentPlaceHolder1"  runat ="server" >
    
    
<!--
        ClientIDMode - 生成客户端 ID 的方式
            ClientIDMode.AutoID - 生成方式和以前一样,为保证唯一,会把其以上各层级的控件ID拿过来拼成一个页面中的唯一ID
            ClientIDMode.Inherit - 继承父控件的客户端ID生成方式
            ClientIDMode.Static - 静态方式。在服务端设置的ID是什么,客户端所呈现的ID就是什么
            ClientIDMode.Predictable - 生成ID的方式为:[Prefix]_[ID]_[Suffix]
        注意:
            在某控件层级中如果没有设置 ClientIDMode,则其默认值为 AutoID
            如果在控件层级中的父级控件设置了 ClientIDMode,则其子控件的默认值为 Inherit
    
-->

    
<!--  ClientIDMode.AutoID 的 Demo  -->
    
< fieldset >
        
< legend > Legacy </ legend >
        
< asp:TextBox  ID ="txtLegacy"  ClientIDMode ="AutoID"  runat ="server"  Text ="ID: txtLegacy"   />
    
</ fieldset >

    
<!--  ClientIDMode.Static 的 Demo  -->
    
< fieldset >
        
< legend > Static </ legend >
        
< asp:TextBox  ID ="txtStatic"  ClientIDMode ="Static"  runat ="server"  Text ="ID: txtStatic"   />
    
</ fieldset >

    
<!--  ClientIDMode.Inherit 的 Demo (注意:Page 上的 ClientIDMode 的值为 Static,所以此控件的客户端ID生成方式也是 Static) -->
    
< fieldset >
        
< legend > Inherit </ legend >
        
< asp:TextBox  ID ="txtInherit"  ClientIDMode ="Inherit"  runat ="server"  Text ="ID: txtInherit"   />
    
</ fieldset >

    
<!--  Predictable 模式中自动分配 Suffix 的方式  -->
    
< fieldset >
        
< legend > Predictable Repeater  </ legend >
        
< div  id ="repeaterContainer" >
            
< asp:Repeater  ID ="repeater"  runat ="server"  ClientIDMode ="Static" >
                
< ItemTemplate >
                    
< div >
                        
< asp:Label  ID ="productPrice"  ClientIDMode ="Predictable"  runat ="server" >
                        
<% #  string .Format(System.Globalization.CultureInfo.CurrentUICulture,  " {0:c} " ,  Eval ( " ProductPrice " )) %>
                        
</ asp:Label >
                    
</ div >
                
</ ItemTemplate >
            
</ asp:Repeater >
        
</ div >
        
< asp:TextBox  ID ="txtPredictableRepeater"  runat ="server"  TextMode ="MultiLine"  Rows ="10"
            ClientIDMode
="Static"  Style ="width: 99%;"   />
    
</ fieldset >

    
<!--  Predictable 模式中分配指定 Suffix 的方式(ClientIDRowSuffix 指定 Suffix 的数据来源)  -->
    
< fieldset >
        
< legend > Predictable ListView  </ legend >
        
< asp:ListView  ID ="listView"  runat ="server"  ClientIDMode ="Static"  ClientIDRowSuffix ="ProductId" >
            
< ItemTemplate >
                
< div >
                    
< asp:Label  ID ="productPrice"  ClientIDMode ="Predictable"  runat ="server" >
                        
<% #  string .Format(System.Globalization.CultureInfo.CurrentUICulture,  " {0:c} " ,  Eval ( " ProductPrice " )) %>
                    
</ asp:Label >
                
</ div >
            
</ ItemTemplate >
            
< LayoutTemplate >
                
< div  id ="listViewContainer" >
                    
< div  id ="itemPlaceholder"  runat ="server"   />
                
</ div >
            
</ LayoutTemplate >
        
</ asp:ListView >
        
< asp:TextBox  ID ="txtPredictableListView"  runat ="server"  TextMode ="MultiLine"  Rows ="10"
            ClientIDMode
="Static"  Style ="width: 99%;"   />
    
</ fieldset >

    
< script  type ="text/javascript" >

        window.onload 
=   function  () {
            document.getElementById(
' <%= txtLegacy.ClientID %> ' ).value  +=   "    ClientID:  "   +   ' <%= txtLegacy.ClientID %> ' ;

            document.getElementById(
' <%= txtStatic.ClientID %> ' ).value  +=   "    ClientID:  "   +   ' <%= txtStatic.ClientID %> ' ;

            document.getElementById(
' <%= txtInherit.ClientID %> ' ).value  +=   "    ClientID:  "   +   ' <%= txtInherit.ClientID %> ' ;

            document.getElementById(
' txtPredictableRepeater ' ).value  =  document.getElementById( ' repeaterContainer ' ).innerHTML;

            document.getElementById(
' txtPredictableListView ' ).value  =  document.getElementById( ' listViewContainer ' ).innerHTML;
        }

    
</ script >
</ asp:Content >

ClientID.aspx.cs
代码
using  System;
using  System.Collections.Generic;
using  System.Linq;
using  System.Web;
using  System.Web.UI;
using  System.Web.UI.WebControls;

namespace  AspDotNet
{
    
public   partial   class  ClientID : System.Web.UI.Page
    {
        
protected   void  Page_Load( object  sender, EventArgs e)
        {
            BindData();
        }

        
//  绑定数据到 ListView
         private   void  BindData()
        {
            Random random 
=   new  Random();

            List
< Product >  products  =   new  List < Product > ();
            
for  ( int  i  =   0 ; i  <   5 ; i ++ )
            {
                products.Add(
new  Product { ProductId  =  i  +   100 , ProductName  =   " 名称 " , ProductPrice  =  random.NextDouble() });
            }

            listView.DataSource 
=  products;
            listView.DataBind();

            repeater.DataSource 
=  products;
            repeater.DataBind();
        }

        
class  Product
        {
            
public   int  ProductId {  get ;  set ; }
            
public   string  ProductName {  get ;  set ; }
            
public   double  ProductPrice {  get ;  set ; }
        }
    }
}


4、EnablePersistedSelection 属性的用法
EnablePersistedSelection.aspx
代码
<% @ Page Title = ""  Language = " C# "  MasterPageFile = " ~/Site.Master "  AutoEventWireup = " true "
    CodeBehind
= " EnablePersistedSelection.aspx.cs "  Inherits = " AspDotNet.EnablePersistedSelection "   %>

< asp:Content  ID ="Content1"  ContentPlaceHolderID ="head"  runat ="server" >
</ asp:Content >
< asp:Content  ID ="Content2"  ContentPlaceHolderID ="ContentPlaceHolder1"  runat ="server" >
    
<!--
        EnablePersistedSelection - 保存选中项的方式
            true - 根据 DataKeyNames 指定的字段做为关键字保存选中项(分页操作不会改变选中项)
            false - 根据行在当前页的表中的索引做为关键字保存选中项(分页后,选中项会发生改变。比如,在第一页选中了第一行,那么分页到第二页的时候选此页的第一行就会被当成选中项,也就是选中项发生了改变)
    
-->

    
< asp:GridView  ID ="gridView"  runat ="server"  AllowPaging ="True"  DataSourceID ="ObjectDataSource1"
        CellPadding
="4"  ForeColor ="#333333"  GridLines ="None"  EnablePersistedSelection ="true"
        DataKeyNames
="productId" >
        
< AlternatingRowStyle  BackColor ="White"   />
        
< Columns >
            
< asp:CommandField  ShowSelectButton ="True"   />
            
< asp:BoundField  DataField ="productId"  HeaderText ="productId"  SortExpression ="productId"   />
            
< asp:BoundField  DataField ="productName"  HeaderText ="productName"  SortExpression ="productName"   />
            
< asp:BoundField  DataField ="productPrice"  HeaderText ="productPrice"  SortExpression ="productPrice"   />
        
</ Columns >
        
< FooterStyle  BackColor ="#990000"  Font-Bold ="True"  ForeColor ="White"   />
        
< HeaderStyle  BackColor ="#990000"  Font-Bold ="True"  ForeColor ="White"   />
        
< PagerStyle  BackColor ="#FFCC66"  ForeColor ="#333333"  HorizontalAlign ="Center"   />
        
< RowStyle  BackColor ="#FFFBD6"  ForeColor ="#333333"   />
        
< SelectedRowStyle  BackColor ="#FFCC66"  Font-Bold ="True"  ForeColor ="Navy"   />
        
< SortedAscendingCellStyle  BackColor ="#FDF5AC"   />
        
< SortedAscendingHeaderStyle  BackColor ="#4D0000"   />
        
< SortedDescendingCellStyle  BackColor ="#FCF6C0"   />
        
< SortedDescendingHeaderStyle  BackColor ="#820000"   />
    
</ asp:GridView >
    
< asp:ObjectDataSource  ID ="ObjectDataSource1"  runat ="server"  SelectMethod ="GetData"
        TypeName
="AspDotNet.EnablePersistedSelection" ></ asp:ObjectDataSource >

</ asp:Content >

EnablePersistedSelection.aspx.cs
代码
using  System;
using  System.Collections.Generic;
using  System.Linq;
using  System.Web;
using  System.Web.UI;
using  System.Web.UI.WebControls;

namespace  AspDotNet
{
    
public   partial   class  EnablePersistedSelection : System.Web.UI.Page
    {
        
protected   void  Page_Load( object  sender, EventArgs e)
        {
            
        }

        
//  为 GridView 提供数据
         public  List < Product >  GetData()
        {
            Random random 
=   new  Random();

            List
< Product >  products  =   new  List < Product > ();
            
for  ( int  i  =   0 ; i  <   100 ; i ++ )
            {
                products.Add(
new  Product { ProductId  =  i  +   1 , ProductName  =   " 名称 " , ProductPrice  =  random.NextDouble() });
            }

            
return  products;
        }
    }

    
//  为 GridView 提供数据的实体类
     public   class  Product
    {
        
public   int  ProductId {  get ;  set ; }
        
public   string  ProductName {  get ;  set ; }
        
public   double  ProductPrice {  get ;  set ; }
    }
}


5、控件的其他一些增强点
ControlsEnhancement.aspx
代码
<% @ Page Title = ""  Language = " C# "  MasterPageFile = " ~/Site.Master "  AutoEventWireup = " true "
    CodeBehind
= " ControlsEnhancement.aspx.cs "  Inherits = " AspDotNet.ControlsEnhancement "   %>

< asp:Content  ID ="Content1"  ContentPlaceHolderID ="head"  runat ="server" >
</ asp:Content >
< asp:Content  ID ="Content2"  ContentPlaceHolderID ="ContentPlaceHolder1"  runat ="server" >

    
<!--
        RenderOuterTable - 指定控件在客户端呈现的时候,是否在外层加 table 标签
            FormView,Login,PasswordRecovery,ChangePassword 控件均有此属性 
    
-->
    
< asp:FormView  ID ="FormView1"  runat ="server"  DefaultMode ="Insert"  RenderOuterTable ="false" >
        
< InsertItemTemplate >
            FormView 的插入模板
        
</ InsertItemTemplate >
    
</ asp:FormView >

    
< br  />< br  />

    
<!--
        Menu 控件,在 asp.net 4.0 中将会以 ul li 的方式呈现在客户端
    
-->
    
< asp:Menu  ID ="Menu1"  runat ="server" >
        
< Items >
            
< asp:MenuItem  Text ="Level 1 - Item 1"  Value ="1" >
                
< asp:MenuItem  Text ="New Item"  Value ="3" ></ asp:MenuItem >
            
</ asp:MenuItem >
            
< asp:MenuItem  Text ="Level 1 - Item 2"  Value ="2" >
                
< asp:MenuItem  Text ="Level 2 - Item 1"  Value ="4" ></ asp:MenuItem >
                
< asp:MenuItem  Text ="Level 2 - Item 2"  Value ="5" ></ asp:MenuItem >
            
</ asp:MenuItem >
        
</ Items >
    
</ asp:Menu >

    
< br  />< br  />

    
<!--
        RepeatLayout - 布局模式,控件在客户端的 HTML 呈现方式
            RepeatLayout.Flow - 流式布局,一行一个选项
            RepeatLayout.OrderedList - ol li 布局
            RepeatLayout.UnorderedList - ul li 布局
            RepeatLayout.Table - Table 布局
            CheckBoxList,RadioButton 控件均有此属性
    
-->
    
< asp:CheckBoxList  ID ="CheckBoxList1"  runat ="server"  RepeatLayout ="UnorderedList" >
        
< asp:ListItem  Text ="Item1"   />
        
< asp:ListItem  Text ="Item2"   />
        
< asp:ListItem  Text ="Item3"   />
        
< asp:ListItem  Text ="Item4"   />
        
< asp:ListItem  Text ="Item5"   />
        
< asp:ListItem  Text ="Item6"   />
    
</ asp:CheckBoxList >

    
< br  />< br  />

    
<!--
        Wizard 和 CreateUserWizard 新增了 LayoutTemplate 模板 ,如下
            headerPlaceholder - runtime时,其内容会被 HeaderTemplate 中的内容替换掉
            sideBarPlaceholder - runtime时,其内容会被 SideBarTemplate 中的内容替换掉
            wizardStepPlaceholder - runtime时,其内容会被 WizardStepTemplate 中的内容替换掉
            navigationPlaceholder - runtime时,其内容会被导航模板中的内容替换掉
    
-->
    
< asp:Wizard  ID ="Wizard1"  runat ="server" >
        
< LayoutTemplate >
            
< div  style ="background-color: Yellow" >
                
< asp:PlaceHolder  ID ="headerPlaceholder"  runat ="server"   />
            
</ div >
            
< asp:PlaceHolder  ID ="sideBarPlaceholder"  runat ="server"   />
            
< asp:PlaceHolder  ID ="wizardStepPlaceholder"  runat ="server"   />
            
< div  style ="background-color: Red" >
                
< asp:PlaceHolder  ID ="navigationPlaceholder"  runat ="server"   />
            
</ div >
        
</ LayoutTemplate >
        
< HeaderTemplate >
            Header
        
</ HeaderTemplate >
        
< WizardSteps >
            
< asp:WizardStep  runat ="server"  Title ="Step 1" >
            
</ asp:WizardStep >
            
< asp:WizardStep  runat ="server"  Title ="Step 2" >
            
</ asp:WizardStep >
        
</ WizardSteps >
    
</ asp:Wizard >

    
< br  />< br  />

    
<!--
        原来使用 ListView 必须要有 LayoutTemplate ,在 asp.net 4.0 中可以不再用它了
    
-->
    
< asp:ListView  ID ="listView"  runat ="server"  ClientIDRowSuffix ="ProductId" >
        
< ItemTemplate >
            
< div  style ="background-color: Fuchsia" >
                
<% #  string .Format(System.Globalization.CultureInfo.CurrentUICulture,  " {0:c} " ,  Eval ( " ProductPrice " )) %>
            
</ div >
        
</ ItemTemplate >
        
<% --
        
< LayoutTemplate >
            
< div style = " background-color: Fuchsia " >
                
< div id = " itemPlaceholder "  runat = " server "   />
            
</ div >
        
</ LayoutTemplate >
        
-- %>
    
</ asp:ListView >

</ asp:Content >

ControlsEnhancement.aspx.cs
代码
using  System;
using  System.Collections.Generic;
using  System.Linq;
using  System.Web;
using  System.Web.UI;
using  System.Web.UI.WebControls;

namespace  AspDotNet
{
    
public   partial   class  ControlsEnhancement : System.Web.UI.Page
    { 
        
protected   void  Page_Load( object  sender, EventArgs e)
        {
            BindData();
        }

        
//  绑定数据到 ListView
         private   void  BindData()
        {
            Random random 
=   new  Random();

            List
< Product >  products  =   new  List < Product > ();
            
for  ( int  i  =   0 ; i  <   5 ; i ++ )
            {
                products.Add(
new  Product { ProductId  =  i  +   1 , ProductName  =   " 名称 " , ProductPrice  =  random.NextDouble() });
            }

            listView.DataSource 
=  products;
            listView.DataBind();
        }

        
class  Product
        {
            
public   int  ProductId {  get ;  set ; }
            
public   string  ProductName {  get ;  set ; }
            
public   double  ProductPrice {  get ;  set ; }
        }
    }
}


OK
[源码下载]
【漏洞复现】Palo Alto Networks PAN-OS GlobalProtect 命令注入漏洞 CVE-2024-3400 在特定PAN-OS版本和不同功能配置下,未经身份验证的攻击者可能利用此漏洞在防火墙上以root权限执行任意代码。技术文章仅供参考,任何个人和组织使用网络应当遵守宪法法律,遵守公共秩序,尊重社会公德,不得利用网络从事危害国家安全、荣誉和利益,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。本文所提供的工具仅用于学习,禁止用于其他!poc如下,注入点在Cookie中,将其中的DNSlog地址替换为你的dnslog地址,借助DNSLOG来复现,可以使用http://dnslog.pw/ 阅读详情

相关推荐

SPI模式下的SD卡读写,为什么你的数据总出错?详解时序与状态机避坑指南

本文深入探讨SPI模式下SD卡读写数据出错的根本原因,提供时序优化与状态机设计的实战指南。针对时钟周期计数、状态机跳转和忙检测等核心问题,详解命令时序细节、状态机同步策略及高级避坑技巧,帮助开发者提升SD卡在SPI模式下的稳定性和性能。

weixin_30514745的博客 267

.NET 4.0 精进不休:约定优于配置与 dynamic 的技术基因溯源

约定优于配置(Convention over Configuration)和 dynamic 是现代 .NET 开发的两大基石概念,前者推动框架从显式声明转向智能推断,后者赋予 C# 运行时动态互操作能力。其原理根植于 .NET 4.0 时代对开发效率与抽象层级的深度重构:通过内置默认约定减少样板代码,借助 DLR 实现跨语言与松耦合集成。这一设计哲学持续影响 EF Core 的 Fluent API、ASP.NET Core 的中间件管道及 JSON 序列化生态。在微服务、低代码和领域驱动开发等场景中,理

unixboy 485

datax web升级springboot3 jdk17

datax web但GitHub上还是springboot2,没有升级过,最近扫漏洞发现spring-core漏洞必须升级到6.x才能解决,这时不得不将springboot升级到3.x,随之而来是jdk、mybatis-plus等等的升级,调整了几天才没问题,痛苦的开发人生~~以上,有疑问欢迎留言。

liyinglong1023的博客 978

升级至ASP.net 4容易引发错误的几点改变

英文原文:ASP.NET 4 Breaking Changeshttp://www.asp.net/learn/whitepapers/aspnet4/breaking-changes  控件生成的代码的变化:Image  和 ImageButton控件 控件不再添加 border="0" 属性。 BaseValidator 类和验证控件不再默认红色文本。 Html

civilman的专栏 1289

UE4引擎分析获取UWord,GName,GetName,GObjectArray

UE4引擎具有很多固定特征和特性 所以我们在逆向UE4引擎开发的游戏的时候,可以利用这些特征和特性. 当然,正常思路逆向也是没问题的(例如我们的ttw课程全数据逆向),你就当多了一个针对于该引擎逆向的快捷方式 或则多了一个思路即可. 正常逆向+引擎分析,使逆向结果全面且快速.

任鸟飞2217777779的博客 1万+

VLA、世界模型与端到端在智驾中的本质关系与工程落地

世界模型并非3D重建,而是对环境状态转移函数的可微分建模;VLA不是视觉+语言+动作的简单拼接,核心在于跨模态语义对齐。二者共同支撑具身智能系统实现从感知到行动的闭环推演,其技术价值体现在长尾场景泛化能力提升与决策延迟降低。在自动驾驶领域,真实量产方案均采用VLA架构作为多模态感知基础,嵌入轻量级世界模型以支持反事实轨迹推演,并通过WA硬件封装保障实时性,最终由端到端控制层完成像素到扭矩的语义贯通。这种混合架构已成L2+/L3智驾系统的工程共识。

weixin_34163553的博客 373

ASP.NET 4.0的七大新特性之"控件的ClientIDMode"

 在早期的ASP.NET框架中,如果你放置一个控件在一个容器中,如GridView模板列、登录模板、其它,在运行时这些控件的ID将被替换由ASP.NET自身产生的随机唯一ID。            为开发者提供服务方访问控件的Page.FindControl("controlid")以及JavaScript中使用 的document.getElementById("controlid

SysThink的专栏 1581

【实战指南】利用CAN适配器高效调试CAN总线通信

本文提供了一份利用CAN适配器高效调试CAN总线通信的实战指南。文章从硬件连接、终端电阻配置、软件参数设置等基础环节入手,详细解析了CAN适配器作为关键调试工具的工作原理与使用方法,并针对常见的通信故障提供了系统化的问题排查思路,帮助工程师快速打通通信链路,提升调试效率。

weixin_28285943的博客 426

ASP.NET 4.0的ClientIDMode属性

时光流逝,我们心爱的ASP.NET也步入了4.0的时代,微软在ASP.NET 4.0中对很多特性做了修改。比如我将要讨论的控件ID机制就是其中之一。 在ASP.NET 4.0之前我们总是要为控件的ClientID头疼,比如明明一个叫lblName的Label放在一个叫做grd的GridView里面后,在页面上改Label的ID就变成了诸如grd_clt02_lblName的一长串...

329

13 万字 C 语言从入门到精通保姆级教程2021 年版

13 万字C语言保姆级教程,从入门到精通。

李南江 61万+

人形机器人硬件电路设计入门

人形机器人属于。

blotemj.blog.csdn.net 240

ASP.NET 4.0的ID,ClientID,UniqueID及ClientIDMode属性篇

QQ:1187362408 欢迎技术交流和学习 ASP.NET 4.0的ID,ClientID,UniqueID及ClientIDMode属性篇(ID,ClientID,UniqueID及ClientIDMode属性): TODO: 1,ID:ID是([1] ID是设计的时候自己所指定的ID,是我们分配给服务器控件的编程标识符,我们常常使用this.controlid来

jiaojiao520专栏 1696

PLC批量读写优化:C# Modbus TCP多寄存器批量操作(效率提升50%)

效率提升:请求次数减少90%以上,通信耗时降低50%-95%;资源节约:减少网络带宽占用和PLC/上位机CPU负载;稳定性提升:更少的请求意味着更少的通信异常;适配高频采集:满足工业现场100ms/次的高频率数据采集需求。工业落地时需注意:批量操作的核心是地址连续化规划,提前与PLC工程师协同规划寄存器地址,是优化的前提;同时需配合重试、校验机制,确保批量操作的可靠性。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1271

配置 ClientIDMode 控件ID生成规则

废话不说先例子: <asp:GridView ID="grd" runat="server"AutoGenerateColumns="False" DataKeyNames="Account Number"> <Columns> <asp:TemplateField HeaderText="Number"> ...

weixin_30394333的博客 531

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

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

asp.net 4.0 新特性之web.config的改进, ViewStateMode, ClientIDMode, EnablePersistedSelection, 控件的其他一些增强点

介绍 asp.net 4.0 的新增功能 简洁的 web.config 文件控件的新属性 ViewStateMode - 控件的视图状态模式控件的新属性 ClientIDMode - 生成客户端 ID 的方式列表控件的新属性 EnablePersistedSelection - 保存选中项的方式控件的其他一些增强点 RenderOuterTable - 指定控件在客户端呈现的时候,是

princelintb的专栏 957

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

精进不休 .NET 4.0 (1) - asp.net 4.0 新特性之web.config的改进

[索引页][源码下载]精进不休 .NET 4.0 (1) - asp.net 4.0 新特性之web.config的改进, ViewStateMode, ClientIDMode, EnablePersistedSelection, 控件的其它一些改进 作者:webabcd介绍asp.net 4.0 的新增功能 简洁的 web.config 文件 控件的...

weixin_34290000的博客 178

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

asp.net 4.0 新特性之web.config的改进控件的其它一些改进

介绍asp.net 4.0 的新增功能 简洁的 web.config 文件 控件的新属性 ViewStateMode - 控件的视图状态模式 控件的新属性 ClientIDMode - 生成客户端 ID 的方式 ...

cuibinmo3519的博客 117

asp.net 4.0 新特性(转载)

介绍asp.net 4.0 的新增功能 简洁的 web.config 文件 控件的新属性 ViewStateMode - 控件的视图状态模式 控件的新属性 ClientIDMode - 生成客户端 ID 的方式 列表控件的新属性 EnablePersistedSelection - 保存选中项的方式 控件的其他一些增强点 RenderOuterTable - 指定控件...

weixin_33736048的博客 105

Dot Net FrameWork 4.0 学习笔记(1)

4.0出来很长时间,由于各种原因各种借口也没有去认真的做过了解,这些由于工作关系,硬着头皮还是把4.0的知识点梳理了一遍,记录如下在这风起云涌的WEB2.0+的后时期,确实微软也在积极引导广大的开发者走向WEB标准化,以下的小小变动无一不体现出设计者的妙思奇想.NetFrameWork分为CLR与ClassLi...

weixin_34232744的博客 234

ASP.NET 4.0的ClientIDMode=”Static”未必是最好

ASP.NET 4.0新增的ClientIDMode是一項重大的更新,不知這是什 的話,可以在這裡看看。 預設ClientIDMode是Inherit 不過我想大多數人都會把焦點放在ClientIDMode=”Static”。 由於預設是Inherit,ClientIDMode會以預設的AutoID去制定Controls ID,或者有人會直接在Page Detective把ClientIDMod...

weixin_34090643的博客 339

ASP.NET4.0 新功能之 ViewStateMode 属性

 ASP.NET4.0 提供了一个叫做 ViewStateMode 的新属性,这个属性可以单独设置控件的视图状态。在以前版本的 ASP.NET 中,控件的视图只有在 Page 的 ViewState 启用的前提下才可以单独控制。在 ASP.NET4.0 中,控件的视图状态可以单独设置了,也就是说,即使页面的视图状态没有启用,控件依然可以启用视图状态。 ViewStateMode 属性是

【孟子E章】 8317

EnableViewState和ViewStateMode

  今天遇到同事有个问题问总监,总监看到页面声明:ViewStateMode=“Disabled” 说关掉页面状态不是这样关的。我就百度了下ViewStateMode和EnableViewState的区别:咋一看没区别。有文章说EnableViewState启用了才能ViewStateMode=“falses”否则ViewStateMode是不会启用的。   继续关注。 转载于:ht...

dibici48543的博客 286
上一篇: 系出名门 Android 系列文章索引
下一篇: 精进不休 .NET 4.0 (2) - asp.net 4.0 新特性之url路由, 自定义CacheProvider, 新增的表达式&lt;%: expression %&gt;, QueryExtender控件, 其它新特性
webabcd
博客等级 码龄17年 28粉丝 911原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址