BPP 相关——01

1、InputPageUtil

2、EditPageUtil



----------------------------------------------------------------------------------------------------------

1、InputPageUtil

功能简述:在输入画面中,总是显示最后一页,本页输入满了则自动跳到下一页(如果还有)。

参数:

int  recordsOfPage —— 每页显示的记录条数(不能小于1,默认10)
int  inputtedCount —— 已经输入产品的个数(不能小于 0)
int  totalCount —— 订单关联的产品总个数(不能小于 1)

各方法描述:

a、计算总页数

	int totalPageCount(){if( totalCount % recordsOfPage == 0 ){return totalCount / recordsOfPage;}return totalCount / recordsOfPage + 1;}

b、计算当前页数

注意:如果 inputtedCount 刚好满页。则要继续判断 ---> 

b-1、如果全部输入完了,那么当前页就是本页

b-2、如果没有全部输入完,那么当前页就为 (本页+1)

特殊值,inputtedCount 为 0 。计算结果为1,也正确。

	int currentPageCount(){	if( inputtedCount % recordsOfPage == 0 ){if( inputtedCount == totalCount ){return inputtedCount / recordsOfPage;}else{return inputtedCount / recordsOfPage + 1;}}return inputtedCount / recordsOfPage + 1;}
c、计算最后页的第一行对应已经输入的 products (List)的索引(用来将最后部分数据 Copy 出来)

显然这个起始索引只能是,0、10、20、30....

	int startIndexForLastPage( int currentPageCount ){return ( currentPageCount - 1 ) * recordsOfPage;}
d、最后页的 Number 数(转换成List,方便strut2 的循环标签使用)


	int lastPageNumberCount( int currentPageCount, int totalPageCount ){if( currentPageCount < totalPageCount ){return recordsOfPage;}else if( currentPageCount == totalPageCount ){if( totalCount % recordsOfPage == 0 ){return recordsOfPage;}return totalCount % recordsOfPage;}else{// this can't happenreturn -1;}}

d、判断是否已经全部输入

	boolean isAllProductsInputted(){return inputtedCount == totalCount;}

完整代码:

package jp.co.snjp.kddi.ht.util;public class InputPageUtil {private static final int DEFAULT_RECORDS_OF_PAGE = 10;private final int recordsOfPage;private final int inputtedCount;private final int totalCount;private InputPageUtil( int inputtedCount, int totalCount ){this( inputtedCount, totalCount, DEFAULT_RECORDS_OF_PAGE );}private InputPageUtil( int inputtedCount, int totalCount, int recordsOfPage ){if( isInvalidParams( inputtedCount, totalCount, recordsOfPage ) ){throw new IllegalStateException("Parameters state error.");}this.inputtedCount = inputtedCount;this.totalCount = totalCount;this.recordsOfPage = recordsOfPage;}private boolean isInvalidParams( int inputtedCount, int totalCount, int recordsOfPage ){if( inputtedCount < 0 || totalCount < 1 || recordsOfPage < 1){return true;}if( totalCount < inputtedCount){return true;}return false;}public int getRecordsOfPage(){return recordsOfPage;}public int getInputtedCount() {return inputtedCount;}public int getTotalCount() {return totalCount;}public static InputPageUtil newInstanceDefaultRecordsOfPage( int inputtedCount, int totalCount ){return new InputPageUtil( inputtedCount, totalCount );}public static InputPageUtil newInstanceSetRecordsOfPage( int inputtedCount, int totalCount, int recordsOfPage ){return new InputPageUtil( inputtedCount, totalCount, recordsOfPage );}boolean isAllProductsInputted(){return inputtedCount == totalCount;}int totalPageCount(){if( totalCount % recordsOfPage == 0 ){return totalCount / recordsOfPage;}return totalCount / recordsOfPage + 1;}int currentPageCount(){	if( inputtedCount % recordsOfPage == 0 ){if( inputtedCount == totalCount ){return inputtedCount / recordsOfPage;}else{return inputtedCount / recordsOfPage + 1;}}return inputtedCount / recordsOfPage + 1;}int startIndexForLastPage( int currentPageCount ){return ( currentPageCount - 1 ) * recordsOfPage;}int lastPageNumberCount( int currentPageCount, int totalPageCount ){if( currentPageCount < totalPageCount ){return recordsOfPage;}else if( currentPageCount == totalPageCount ){if( totalCount % recordsOfPage == 0 ){return recordsOfPage;}return totalCount % recordsOfPage;}else{// this can't happenreturn -1;}}public Status computeAllStatus(){int totalPageCount = totalPageCount();int currentPageCount = currentPageCount();int startIndexForLastPage = startIndexForLastPage( currentPageCount );int lastPageNumberCount = lastPageNumberCount( currentPageCount, totalPageCount );boolean allProductsInputted = isAllProductsInputted();return new Status( currentPageCount, totalPageCount, startIndexForLastPage, lastPageNumberCount, allProductsInputted );}public static class Status{private final int totalPageCount;private final int currentPageCount;private final int startIndexForLastPage;private final int lastPageNumberCount;private final boolean allProductsInputted;private Status( int currentPageCount, int totalPageCount, int startIndexForLastPage, int lastPageNumberCount, boolean allProductsInputted ){this.currentPageCount = currentPageCount;this.totalPageCount = totalPageCount;this.startIndexForLastPage =startIndexForLastPage;this.lastPageNumberCount = lastPageNumberCount;this.allProductsInputted = allProductsInputted;}public int getCurrentPageCount() {return currentPageCount;}public int getLastPageNumberCount() {return lastPageNumberCount;}public int getStartIndexForLastPage() {return startIndexForLastPage;}public int getTotalPageCount() {return totalPageCount;}public boolean isAllProductsInputted() {return allProductsInputted;}}}

使用示例:

	void initContinueManualInputParam(  T03SlipWk orderForm, List<T04CaseDtlWk> products ){assert orderForm != null;assert products != null;assert products.size() != 0;productName = orderForm.getProdNm1();productCount = orderForm.getShpVol1().intValue();InputPageUtil.Status inputPageStatus = InputPageUtil.newInstanceDefaultRecordsOfPage( products.size(), productCount ).computeAllStatus();allProductsInput = inputPageStatus.isAllProductsInputted();totalPageCount = inputPageStatus.getTotalPageCount();currentPageCount = inputPageStatus.getCurrentPageCount();int startIndexForLastPage = inputPageStatus.getStartIndexForLastPage();int lastPageNumberCount = inputPageStatus.getLastPageNumberCount();lastPageProducts = lastPageProducts( startIndexForLastPage, products );lastPageRecords = lastPageRecords( lastPageNumberCount );}// 相关的两个方法List<String> lastPageProducts( int startIndexForLastPage, List<T04CaseDtlWk> products ){List<String> result = new ArrayList<String>();while( startIndexForLastPage < products.size() ){T04CaseDtlWk product = (T04CaseDtlWk)products.get( startIndexForLastPage );result.add( formatNumber( product.getShpWt2() ) );startIndexForLastPage++;}return result;}List<Integer> lastPageRecords( int lastPageNumberCount ){List<Integer> result = new ArrayList<Integer>();for( int i = 0 ; i < lastPageNumberCount ; i++ ){result.add( i );}return result;}

2、EditPageUtil

功能简述:

进入编辑页面,根据 page_line 参数来确定显示的“当前页”和 选中状态的“当前行”,如果 page_line 为 null (从输入页面进入编辑页面),则默认显示第一页,选中第一行。

参数:

int recordsOfPage —— 页面记录条数(不能小于1,默认为10)
int inputtedCount —— 已经输入产品个数(不能小于1,这里如果一个都没有输入会构造一个 BlankProduct,这样进入编辑页就可以直接输入)
int totalCount —— 订单关联的产品总个数(不能小于 1)
String page_line —— JSP 页面传递的参数,用来确定页和行

各方法描述:

a、计算总页数

	int totalPageCount(){if( totalCount % recordsOfPage == 0 ){return totalCount / recordsOfPage;}return totalCount / recordsOfPage + 1;}
b、计算当前页

	// 1. 第一次从输入页面->编辑页面 ( page_line为null, 默认第一页面)// 2. 编辑修改保存后->再次进入 (根据 page_line 参数解析)int currentPageCount(){// 1if( page_line == null ){return 1;}// 2int page = parsePage();if( page < 1){return 1;}else if( maxEditablePageCount() < page ){return maxEditablePageCount();}else{return page;}}
c、计算当前行

	int currentLine( int currentPageCount ){// 1if( page_line == null ){return 1;}// 2int line = parseLine();if( line < 1 ){return 1;}else if( maxEditableLine( currentPageCount ) < line ){return maxEditableLine( currentPageCount );}else{return line;}}
d、计算当前页的记录条数(也就是 JSP 页面,HT 的 Select控件 option 的个数)
	// select 控件要用int productRecordCountOfCurrentPage( int currentPageCount ){if( inputtedCount < ( currentPageCount * recordsOfPage ) ){return inputtedCount - ( currentPageCount - 1 ) * recordsOfPage;}return recordsOfPage;}
e、计算当前页的第一行对应已经输入的 products (List)的索引(用来将最后部分数据 Copy 出来)

显然这个起始索引只能是,0、10、20、30....

	int startIndexForCopy( int currentPageCount ){return ( currentPageCount - 1 ) * recordsOfPage;}
f、判断是否有上一页 和是否有下一页

	boolean hasPrePage( int currentPageCount ){return 1 < currentPageCount ? true : false;}boolean hasNextPage( int currentPageCount ){return currentPageCount < maxEditablePageCount() ? true : false;}
g、构造 page_line 参数

	String pageLine( int currentPageCount, int currentLine ){return currentPageCount + "_" + currentLine;}


完整代码:

package jp.co.snjp.kddi.ht.util;import java.util.regex.Matcher;
import java.util.regex.Pattern;public class EditPageUtil {private static final int DEFAULT_RECORDS_OF_PAGE = 10;private final int recordsOfPage;private final int inputtedCount;private final int totalCount;private final String page_line;public int getInputtedCount() {return inputtedCount;}public int getRecordsOfPage() {return recordsOfPage;}public int getTotalCount() {return totalCount;}private EditPageUtil( int inputtedCount, int totalCount, String page_line ){this( inputtedCount, totalCount, page_line, DEFAULT_RECORDS_OF_PAGE );}private EditPageUtil( int inputtedCount, int totalCount, String page_line, int recordsOfPage ){if( isInvalidParams( inputtedCount, totalCount, page_line, recordsOfPage ) ){throw new IllegalStateException("Parameters state error.");}this.inputtedCount = inputtedCount;this.totalCount = totalCount;this.page_line = page_line;this.recordsOfPage = recordsOfPage;}private boolean isInvalidParams( int inputtedCount, int totalCount, String page_line, int recordsOfPage ){// 这里 inputtedCount 至少会有一个 BlankProduct, 用于在编辑模式下输入if( inputtedCount < 1 || totalCount < 1 || recordsOfPage < 1){return true;}if( totalCount < inputtedCount){return true;}if( page_line != null && !page_line.trim().equals("") ){return notMatcher( page_line, "\\d+_\\d+" );}return false;}private boolean notMatcher( String sequence, String regex ){Pattern p = Pattern.compile(regex);Matcher m = p.matcher( sequence.trim() );return !m.matches();}public static EditPageUtil newInstanceDefaultRecordsOfPage( int inputtedCount, int totalCount, String page_line ){return new EditPageUtil( inputtedCount, totalCount, page_line );}public static EditPageUtil newInstanceSetRecordsOfPage( int inputtedCount, int totalCount, String page_line, int recordsOfPage ){return new EditPageUtil( inputtedCount, totalCount,page_line, recordsOfPage );}int totalPageCount(){if( totalCount % recordsOfPage == 0 ){return totalCount / recordsOfPage;}return totalCount / recordsOfPage + 1;}// 1. 第一次从输入页面->编辑页面 ( page_line为null, 默认第一页面)// 2. 编辑修改保存后->再次进入 (根据 page_line 参数解析)int currentPageCount(){// 1if( page_line == null ){return 1;}// 2int page = parsePage();if( page < 1){return 1;}else if( maxEditablePageCount() < page ){return maxEditablePageCount();}else{return page;}}int currentLine( int currentPageCount ){// 1if( page_line == null ){return 1;}// 2int line = parseLine();if( line < 1 ){return 1;}else if( maxEditableLine( currentPageCount ) < line ){return maxEditableLine( currentPageCount );}else{return line;}}private int maxEditableLine( int currentPageCount ){return productRecordCountOfCurrentPage( currentPageCount );}// select 控件要用int productRecordCountOfCurrentPage( int currentPageCount ){if( inputtedCount < ( currentPageCount * recordsOfPage ) ){return inputtedCount - ( currentPageCount - 1 ) * recordsOfPage;}return recordsOfPage;}int startIndexForCopy( int currentPageCount ){return ( currentPageCount - 1 ) * recordsOfPage;}boolean hasPrePage( int currentPageCount ){return 1 < currentPageCount ? true : false;}boolean hasNextPage( int currentPageCount ){return currentPageCount < maxEditablePageCount() ? true : false;}String pageLine( int currentPageCount, int currentLine ){return currentPageCount + "_" + currentLine;}// 可以"翻页"的最大页数private int maxEditablePageCount(){if( inputtedCount % recordsOfPage == 0 ){return inputtedCount / recordsOfPage;}return inputtedCount / recordsOfPage + 1;}private int parsePage(){String[] params = page_line.split( "_" );String page = params[0].trim();return Integer.valueOf( page ).intValue();}private int parseLine(){String[] params = page_line.split( "_" );String line = params[1].trim();return Integer.valueOf( line ).intValue();}public Status computeAllStatus(){int totalPageCount = totalPageCount();int currentPageCount = currentPageCount();int currentLine = currentLine( currentPageCount );int productRecordCountOfCurrentPage = productRecordCountOfCurrentPage( currentPageCount );int startIndexForCopy = startIndexForCopy( currentPageCount );String pageLine = pageLine( currentPageCount, currentLine );boolean hasPrePage = hasPrePage( currentPageCount );boolean hasNextPage = hasNextPage( currentPageCount );return new Status( totalPageCount, currentPageCount, currentLine,productRecordCountOfCurrentPage, startIndexForCopy,pageLine, hasPrePage, hasNextPage);}public static class Status{private final int totalPageCount;private final int currentPageCount;private final int currentLine;private final int productRecordCountOfCurrentPage;private final int startIndexForCopy;private final String pageLine;private final boolean hasPrePage;private final boolean hasNextPage;private Status( int totalPageCount, int currentPageCount, int currentLine, int productRecordCountOfCurrentPage, int startIndexForCopy, String pageLine, boolean hasPrePage, boolean hasNextPage) {this.totalPageCount = totalPageCount;this.currentPageCount = currentPageCount;this.currentLine = currentLine;this.productRecordCountOfCurrentPage = productRecordCountOfCurrentPage;this.startIndexForCopy = startIndexForCopy;this.pageLine = pageLine;this.hasPrePage = hasPrePage;this.hasNextPage = hasNextPage;}public int getCurrentLine() {return currentLine;}public int getCurrentPageCount() {return currentPageCount;}public boolean getHasNextPage() {return hasNextPage;}public boolean getHasPrePage() {return hasPrePage;}public String getPageLine() {return pageLine;}public int getProductRecordCountOfCurrentPage() {return productRecordCountOfCurrentPage;}public int getStartIndexForCopy() {return startIndexForCopy;}public int getTotalPageCount() {return totalPageCount;}}
}

使用示例:

	void initEditJspParam( ){T03SlipWk orderForm = (T03SlipWk) session.get( "SLIP_WK" );List<T04CaseDtlWk> products = getEditableProducts( orderForm );LOG.info( "products.size()=" + products.size() );productName = orderForm.getProdNm1();productCount = orderForm.getShpVol1().intValue();String page_line = request.getParameter( "page_line" );EditPageUtil.Status editPageStatus = EditPageUtil.newInstanceDefaultRecordsOfPage( products.size(), productCount, page_line).computeAllStatus();totalPageCount = editPageStatus.getTotalPageCount();currentPageCount = editPageStatus.getCurrentPageCount();currentLine = editPageStatus.getCurrentLine();currentPageProductRecords = editPageStatus.getProductRecordCountOfCurrentPage();currentPageProducts = currentPageProducts( products, editPageStatus );hasPrePage = editPageStatus.getHasPrePage();hasNextPage = editPageStatus.getHasNextPage();pageLine = editPageStatus.getPageLine();LOG.info( "currentPageCount=" + currentPageCount );LOG.info( "currentLine=" + currentLine );LOG.info( "currentPageProductRecords=" + currentPageProductRecords );LOG.info( "hasPrePage=" + hasPrePage );LOG.info( "hasNextPage=" + hasNextPage );}//  计算显示在当前页面的商品List<String> currentPageProducts( List<T04CaseDtlWk> products, EditPageUtil.Status status ){List<String> results = new ArrayList<String>();int currentPageProductRecords = status.getProductRecordCountOfCurrentPage();int startIndexForCopy = status.getStartIndexForCopy();int copyedCount = 0;final String BLANK = "    ";while( copyedCount < currentPageProductRecords ){T04CaseDtlWk product = products.get( startIndexForCopy );BigDecimal wt2 = product.getShpWt2();if( wt2 == null ){results.add( BLANK );}else{results.add( manualInputAction.formatNumber( wt2 ) );}startIndexForCopy++;copyedCount++;}return results;}	// 获取可编辑 的商品************************************ 注意这个方法对BlankProduct 的操作List<T04CaseDtlWk> getEditableProducts( T03SlipWk orderForm ){List<T04CaseDtlWk> products = manualInputAction.getProductsFromDB( orderForm );// 商品没有完全输入, 在最后加入一个 BlankProduct, 用于输入if( products.size() < orderForm.getShpVol1().intValue() ){String slipId = orderForm.getSlipId();products.add( constructBlankProduct( slipId ) );}return products;}T04CaseDtlWk constructBlankProduct( String slipId ){T04CaseDtlWk product = new T04CaseDtlWk();product.setSlipId( slipId );// 要保证通过 page_line 计算出来的 caseId 找不到这个BlankProductproduct.setCaseId( -1 );product.setShpWt2( null );return product;}










































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

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

相关文章

传感器数据完善 AI 功能,激起机器人“网络效应”

来源&#xff1a;36氪 概要&#xff1a;传感器数据将有助于推动AI的发展。 AI系统也同时扩展我们处理数据的能力&#xff0c;并帮助我们发现这些数据的创造性用途。 现在我们都对AI很熟悉了&#xff0c;也知道算法的完善离不开海量的数据。数据量越大&#xff0c;算法给出的结…

比AlphaGo Zero更强的AlphaZero来了!8小时解决一切棋类!

来源&#xff1a;本文作者PENG Bo&#xff08;http://t.cn/RY3MKSS&#xff09;&#xff0c;本文首发于作者的知乎专栏《技术备忘录》 读过AlphaGo Zero论文的同学&#xff0c;可能都惊讶于它的方法的简单。另一方面&#xff0c;深度神经网络&#xff0c;是否能适用于国际象棋这…

直接插入排序比较次数_程序员必须要会的直接插入排序算法

算法主要衡量标准时间复杂度(运行时间)在算法时间复杂度维度&#xff0c;我们主要对比较和交换的次数做对比&#xff0c;其他不交换元素的算法&#xff0c;主要会以访问数组的次数的维度做对比。其实有很多同学对于算法的时间复杂度有点模糊&#xff0c;分不清什么所谓的 O(n),…

脑机接口技术如何具体实现?

来源&#xff1a;神经科技前沿 概要&#xff1a;人类心灵能够与人工智能、机器人和其它心灵通过脑机接口技术(BCI)直接相连&#xff0c;从而超越人类寿命的限制吗? 就像古希腊人梦想在天空翱翔一样&#xff0c;今天的人们总是梦想着将大脑与机器融合来解决令人讨厌的死亡问题。…

BPP 相关——02

BPP项目 HT 部分完成小结&#xff1a; 1、Action 类怎么写&#xff1f; 现在的做法是Action 层直接与 dao 层耦合&#xff0c;所有的功能都在 Action 类中完成。 缺点&#xff1a;如果 Action1 与 Action2 两个类有部分功能重复&#xff0c;在“避免重复代码”这样的原则下&am…

scrapy读取mysql数据库_python3实战scrapy获取数据保存至MySQL数据库

python3使用scrapy获取数据然后保存至MySQL数据库&#xff0c;我上一篇写了如何爬取数据保存为csv文件&#xff0c;这一篇将会写如何将数据保存至数据库。思路大都一样&#xff0c;我列一个思路&#xff1a;1&#xff1a;获取腾讯招聘网。2&#xff1a;筛选信息获取我们想要的。…

共享单车技术含量,一篇文章全说透了!

来源&#xff1a;物联网智库 概要&#xff1a;共享单车已经成为了中国新四大发明之一&#xff0c;被输往了世界上很多城市。 共享单车已经成为了中国新四大发明之一&#xff0c;被输往了世界上很多城市。在我看来&#xff0c;虽然共享单车的实现并不复杂&#xff0c;其实质是一…

PostgreSQL 分页——示例

SQL 语句 select * from ( select * from logizard.t04_case_dtl_wk where slip_id order100~1~l001 order by case_id ) as T04 limit 5 offset 0 ;结果图

人工智能企业自动化的关键现状和战略影响

来源&#xff1a;腾股创投&#xff08;微信ID: tengguvc&#xff09; 人工智能和机器学习在亚马逊 Alexa 等面向消费者的应用领域取得了长足的进步&#xff0c;在企业内的的部署也不断涌现。 关于 AI 自动化对企业的影响范围和影响程度的意见不一。 一方面&#xff0c;牛津大学…

Mac 右键拷贝文件失效

问题&#xff1a;Mac 右键拷贝文件失效&#xff0c;有时候拷贝可以成功&#xff0c;有时候拷贝不成功 发现问题所在&#xff1a;开了百度翻译的划词&#xff0c; 解决&#xff1a;把划词关掉就好了&#xff0c;或者设置划词快捷键翻译就好了&#xff0c;反正就不要一划就翻译那…

为什么神经网络会把乌龟识别成步枪?现在的 AI 值得信任吗?

来源&#xff1a;36Kr 概要&#xff1a;人工智能的快速发展的确值得欣喜&#xff0c;但快速发展的背后还有各种不完善的地方。 人工智能的快速发展的确值得欣喜&#xff0c;但快速发展的背后还有各种不完善的地方。比如&#xff0c;前不久麻省理工学院的一些学生&#xff0c;利…

Struts2自定义标签——示例

自定义Button功能描述&#xff1a; <tangs:button items"apple,orange,banana"/> 解析后为&#xff1a; <input type"button" name"apple" value"apple" /> <input type"button" name"orange…

深度学习的核心:掌握训练数据的方法

来源&#xff1a;云栖社区 概要&#xff1a;今天我们将讨论深度学习中最核心的问题之一&#xff1a;训练数据。 Hello World&#xff01; 今天我们将讨论深度学习中最核心的问题之一&#xff1a;训练数据。深度学习已经在现实世界得到了广泛运用&#xff0c;例如&#xff1a;无…

python停止运行tensorflow_Tensorflow 开启训练后卡死

毕设做深度学习的课题&#xff0c;使用到了TensorFlow&#xff0c;但训练时出现了问题&#xff1a;跑脚本开启训练之后&#xff0c;跑完不到100次就会卡死&#xff0c;然后显示python已停止工作这是我的训练的代码# 导入数据集import load_record# 导入TensorFlow并创建Session…

Struts2自定义标签(template)——示例

来源&#xff1a;http://www.blogjava.net/natlive/archive/2009/05/21/271890.html Struts2 的UITag原理&#xff1a; Struts2 UITag分三部份组成&#xff0c;一部份用于定义Tag的内容与逻辑的UIBean&#xff0c;一部份用于定义JSP Tag&#xff0c;也就是平时我们定义的那种&…

详解5G的六大关键技术

来源&#xff1a;电子产品世界 概要&#xff1a;在5G研发刚起步的情况下&#xff0c;如何建立一套全面的5G关键技术评估指标体系和评估方法&#xff0c;实现客观有效的第三方评估&#xff0c;服务技术与资源管理的发展需要&#xff0c;同样是当前5G技术发展所面临的重要问题。 …

为什么说特斯拉研发自动驾驶AI芯片应该引起注意?

来源&#xff1a;36Kr 概要&#xff1a;对于特斯拉而言&#xff0c;研发这款芯片配套算法本质上还是对率先将自动驾驶汽车商业化节点的争夺。 特斯拉Model 3的量产问题仍未彻底解决&#xff0c;CEO Elon Musk又抛出了自研自动驾驶芯片的重磅新闻。 Elon Musk和特斯拉Autopilo…

stm32usb做虚拟串口和键盘_关于stm32f103的USB虚拟串口程序移植

手边有个项目要用到USB传数据到主机&#xff0c;虽然有很多种方式&#xff0c;但最后还是选择了USB虚拟串口模式&#xff0c;将数据上传至pc端&#xff1b;然而这就涉及到了移植问题&#xff0c;在keil下官方已经给出了一个完整的USB TO VCOM的demo&#xff0c;但在我的主机上装…

4篇Nature同时揭示DNA自组装技术,离人造生命又近了一步

来源&#xff1a;刘盼科学网博客 概要&#xff1a; 科学家一直渴望利用自组装来构建人造物体&#xff0c;以达到细胞或细胞器的尺寸和复杂性&#xff0c;以便为研究&#xff0c;工程和医学应用构建合成的细胞机器。 iNature&#xff1a;自组装过程以各种形式存在于自然界中&…

均方距离计算公式_均值、方差、均方值、均方差计算

1、均值 均值表示信号中直流分量的大小,用E(x)表示。对于高斯白噪声信号而言,它的均值为0,所以它只有交流分量。 2、均值的平方 均值的平方,用{E(x)}^2表示,它表示的是信号中直流分量的功率。 3、均方值 均方值表示信号平方后的均值,用E(x^2)表示。均方值表示信号的平均功…