Jasperreports+jaspersoft studio学习教程(八)- 报表分页和大量数据内存处理

本文主要是介绍Jasperreports+jaspersoft studio学习教程(八)- 报表分页和大量数据内存处理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

9.1 设计报表模板

9.1.1 使用Table组件新建模板(步骤参考教程七)如下:

9.1.2 模板自带变量

$V{PAGE_NUMBER} :代表当前页数(可以是页码也可以是页数,通过TextField的计算时间的不同值来设置)

$V{PAGE_COUNT} :当前页面中记录的数目

$V{groupname_COUNT} :   代表当前组的记录数

$V{COLUMN_NUMBER} :列号码

$V{COLUMN_COUNT} :当前列中记录的数目(是当前页里行的序号,在新页上会重置为1)

$V{REPORT_COUNT} :当前文档中数据源记录数目。

这里主要使用 $V{PAGE_NUMBER} 来做报表分页

对于$V{PAGE_NUMBER}:当evaluationTime="Now"时,即是计算当页所在哪一页。 (now:即时执行此表达式)

当evaluationTime="Report"时,计算最后一页,即总页数。(Report:整个报表执行完后才执行此表达式)

9.1.3 拖动6个Text Field组件到Page Footer Band中

设置 第几页 ,注意 其 Evaluation Time 选中 Now。

设置 共几页 ,注意 其 Evaluation Time 选中 Report。

9.1.4 设置 首页、上一页、下一页、末页 需要使用超链接

新建一个模板,把 首页 拷贝过去(这里使用DemoReport1.jrxml)

点击首页显示Properties ,搜索HyperLink PageException

设置 链接 为 “https://www.baidu.com/”

保存后,以 HTML 方式 Preview 后,点击首页跳转到百度。

9.1.5 设置 首页、上一页、下一页、末页

在 Hyperlink PageExpression 框中输入时需要注意,我们需要设定变量才能正确的导向是哪一页

以下是各选择在HyperlinkPage Expression框中输入的信息

首页   : "/JasperWeb/JasperServlet9?page=0"

上一页 :  "/JasperWeb/JasperServlet9?page="+($V{PAGE_NUMBER}-Long.valueOf("1"))

下一页 :  "/JasperWeb/JasperServlet9?page="+($V{PAGE_NUMBER}+Long.valueOf("1"))

末页   : "/JasperWeb/JasperServlet9?page=lastPage"

保存模板文件后拷贝到JasperWeb项目中

9.2 编写java代码,实现分页逻辑及大量数据内存处理

 

访问servlet,如下:

将第三页存储在磁盘中。


 

DemoReport9.jrxml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="DemoReport9" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="0" bottomMargin="0" uuid="d7c90b7d-72ba-419f-94bd-d1d1ebac1597"><property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/><property name="com.jaspersoft.studio.unit." value="pixel"/><property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/><property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/><property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/><property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/><property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/><property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/><property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/><property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/><style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"><box><pen lineWidth="0.5" lineColor="#000000"/><topPen lineWidth="0.5" lineColor="#000000"/><leftPen lineWidth="0.5" lineColor="#000000"/><bottomPen lineWidth="0.5" lineColor="#000000"/><rightPen lineWidth="0.5" lineColor="#000000"/></box></style><style name="Table_CH" mode="Opaque" backcolor="#BFE1FF"><box><pen lineWidth="0.5" lineColor="#000000"/><topPen lineWidth="0.5" lineColor="#000000"/><leftPen lineWidth="0.5" lineColor="#000000"/><bottomPen lineWidth="0.5" lineColor="#000000"/><rightPen lineWidth="0.5" lineColor="#000000"/></box></style><style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"><box><pen lineWidth="0.5" lineColor="#000000"/><topPen lineWidth="0.5" lineColor="#000000"/><leftPen lineWidth="0.5" lineColor="#000000"/><bottomPen lineWidth="0.5" lineColor="#000000"/><rightPen lineWidth="0.5" lineColor="#000000"/></box></style><subDataset name="Dataset1" uuid="38de2d28-85cc-4464-90e5-b3a328724707"><property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/><queryString><![CDATA[]]></queryString><field name="userId" class="java.lang.Integer"/><field name="userName" class="java.lang.String"/><field name="grade" class="java.lang.String"/><field name="college" class="java.lang.String"/><field name="mobile" class="java.lang.String"/></subDataset><queryString><![CDATA[]]></queryString><field name="tableData" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/><field name="date" class="java.lang.String"/><title><band height="60" splitType="Stretch"><property name="com.jaspersoft.studio.unit.height" value="pixel"/><textField><reportElement x="0" y="10" width="800" height="40" uuid="b96cd39e-8959-469c-bdb2-747d5750e575"><property name="com.jaspersoft.studio.unit.y" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="pixel"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="24"/></textElement><textFieldExpression><![CDATA["用户信息表"]]></textFieldExpression></textField></band></title><pageHeader><band height="30" splitType="Stretch"><property name="com.jaspersoft.studio.unit.height" value="pixel"/><textField><reportElement x="640" y="0" width="160" height="30" uuid="aa748f9a-c2ff-4b50-bf34-b586e1e221cd"/><textElement textAlignment="Right" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA["日期:"+$F{date}]]></textFieldExpression></textField></band></pageHeader><detail><band height="50" splitType="Stretch"><property name="com.jaspersoft.studio.unit.height" value="pixel"/><componentElement><reportElement x="0" y="0" width="800" height="50" uuid="1adbebf1-674c-4aac-9b79-2afa0b77f6e6"><property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/><property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/><property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/><property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/><property name="com.jaspersoft.studio.unit.x" value="pixel"/><property name="com.jaspersoft.studio.unit.y" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="pixel"/></reportElement><jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"><datasetRun subDataset="Dataset1" uuid="65713b63-7b23-4cef-9297-cd0b0a50742d"><dataSourceExpression><![CDATA[$F{tableData}]]></dataSourceExpression></datasetRun><jr:column width="160" uuid="adf9bff4-2683-400d-8c4d-0c0984e93f0d"><property name="com.jaspersoft.studio.unit.height" value="pixel"/><property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><jr:columnHeader style="Table_CH" height="30" rowSpan="1"><property name="com.jaspersoft.studio.unit.width" value="px"/><textField><reportElement x="0" y="0" width="160" height="30" uuid="0b36445f-cb93-4cc7-8467-1001e0bc9138"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="14"/></textElement><textFieldExpression><![CDATA["学号"]]></textFieldExpression></textField></jr:columnHeader><jr:detailCell style="Table_TD" height="20"><property name="com.jaspersoft.studio.unit.width" value="px"/><property name="com.jaspersoft.studio.unit.height" value="px"/><textField><reportElement x="0" y="0" width="160" height="20" uuid="06cfd83a-dde4-44d9-bc68-52fe7ae14a8e"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA[$F{userId}]]></textFieldExpression></textField></jr:detailCell></jr:column><jr:column width="160" uuid="10201ee5-5600-4d8d-966d-e8d3f6976801"><property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><jr:columnHeader style="Table_CH" height="30" rowSpan="1"><property name="com.jaspersoft.studio.unit.width" value="px"/><textField><reportElement x="0" y="0" width="160" height="30" uuid="14d03642-b623-4b5b-b719-2fe8bbaa0a4e"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="14"/></textElement><textFieldExpression><![CDATA["姓名"]]></textFieldExpression></textField></jr:columnHeader><jr:detailCell style="Table_TD" height="20"><textField><reportElement x="0" y="0" width="160" height="20" uuid="06001ccc-e18d-4f17-b579-151a8a0d1d57"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA[$F{userName}]]></textFieldExpression></textField></jr:detailCell></jr:column><jr:column width="160" uuid="3a5875e8-f8d4-4289-a2c0-339f203a0a9c"><property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><jr:columnHeader style="Table_CH" height="30" rowSpan="1"><property name="com.jaspersoft.studio.unit.width" value="px"/><textField><reportElement x="0" y="0" width="160" height="30" uuid="fecac7e3-9c5f-4ae5-b9bf-e740cb1acaa9"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="14"/></textElement><textFieldExpression><![CDATA["年级"]]></textFieldExpression></textField></jr:columnHeader><jr:detailCell style="Table_TD" height="20"><textField><reportElement x="0" y="0" width="160" height="20" uuid="449cd8b8-e07e-44d6-a654-9382041e19b6"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA[$F{grade}]]></textFieldExpression></textField></jr:detailCell></jr:column><jr:column width="160" uuid="8d0acd4a-e38f-452e-8f83-b9f471cc6e6c"><property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><jr:columnHeader style="Table_CH" height="30" rowSpan="1"><property name="com.jaspersoft.studio.unit.width" value="px"/><textField><reportElement x="0" y="0" width="160" height="30" uuid="71f6ec6b-9fff-4033-a6b3-4859cef156b9"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="14"/></textElement><textFieldExpression><![CDATA["学院"]]></textFieldExpression></textField></jr:columnHeader><jr:detailCell style="Table_TD" height="20"><textField><reportElement x="0" y="0" width="160" height="20" uuid="c4d5d4f7-e9fe-4a19-b8d6-09e8043ea51a"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA[$F{college}]]></textFieldExpression></textField></jr:detailCell></jr:column><jr:column width="160" uuid="f05e42f0-7427-4e35-a528-fed13c202a0a"><property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><jr:columnHeader style="Table_CH" height="30" rowSpan="1"><property name="com.jaspersoft.studio.unit.width" value="px"/><textField><reportElement x="0" y="0" width="160" height="30" uuid="ab76786f-1468-43cb-965e-6469f9f21363"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="14"/></textElement><textFieldExpression><![CDATA["手机"]]></textFieldExpression></textField></jr:columnHeader><jr:detailCell style="Table_TD" height="20"><textField><reportElement x="0" y="0" width="160" height="20" uuid="5db1623e-b62b-449c-82ed-e796243710e7"/><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA[$F{mobile}]]></textFieldExpression></textField></jr:detailCell></jr:column></jr:table></componentElement></band></detail><pageFooter><band height="54" splitType="Stretch"><textField hyperlinkType="Reference"><reportElement x="620" y="5" width="30" height="20" uuid="e77c471c-6f7a-4611-aa73-fb7e3a88c93d"><property name="com.jaspersoft.studio.unit.y" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="pixel"/><property name="com.jaspersoft.studio.unit.x" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA["首页"]]></textFieldExpression><hyperlinkReferenceExpression><![CDATA["/JasperWeb/JasperServlet9?page=0"]]></hyperlinkReferenceExpression></textField><textField hyperlinkType="Reference"><reportElement x="650" y="5" width="50" height="20" uuid="6709103c-8b77-4690-b2e4-468bd8e5544e"><property name="com.jaspersoft.studio.unit.y" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="pixel"/><property name="com.jaspersoft.studio.unit.x" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="10"/></textElement><textFieldExpression><![CDATA["上一页"]]></textFieldExpression><hyperlinkReferenceExpression><![CDATA["/JasperWeb/JasperServlet9?page="+($V{PAGE_NUMBER}-Long.valueOf("1"))]]></hyperlinkReferenceExpression></textField><textField hyperlinkType="Reference"><reportElement x="700" y="5" width="50" height="20" uuid="4263bf73-f221-41b4-9df2-4eaeea435a9f"><property name="com.jaspersoft.studio.unit.y" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="pixel"/><property name="com.jaspersoft.studio.unit.x" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA["下一页"]]></textFieldExpression><hyperlinkReferenceExpression><![CDATA["/JasperWeb/JasperServlet9?page="+($V{PAGE_NUMBER}+Long.valueOf("1"))]]></hyperlinkReferenceExpression></textField><textField hyperlinkType="Reference"><reportElement x="750" y="5" width="30" height="20" uuid="704e48cb-9208-4703-b260-05662ea65334"><property name="com.jaspersoft.studio.unit.height" value="pixel"/><property name="com.jaspersoft.studio.unit.x" value="pixel"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA["末页"]]></textFieldExpression><hyperlinkReferenceExpression><![CDATA["/JasperWeb/JasperServlet9?page=lastPage"]]></hyperlinkReferenceExpression></textField><textField><reportElement x="510" y="5" width="50" height="20" uuid="b1b31a99-915b-479b-8eb2-e7496ec9021f"><property name="com.jaspersoft.studio.unit.x" value="pixel"/><property name="com.jaspersoft.studio.unit.y" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="pixel"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑"/></textElement><textFieldExpression><![CDATA["第"+$V{PAGE_NUMBER}+"页"]]></textFieldExpression></textField><textField evaluationTime="Report"><reportElement x="560" y="5" width="60" height="20" uuid="6f34ea83-3dde-4765-b882-82997673eeaf"><property name="com.jaspersoft.studio.unit.y" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="pixel"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font fontName="微软雅黑" size="10"/></textElement><textFieldExpression><![CDATA["共"+$V{PAGE_NUMBER}+"页"]]></textFieldExpression></textField></band></pageFooter>
</jasperReport>

JasperServlet9.java

package com.jasper.web;import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
import net.sf.jasperreports.engine.fill.JRFileVirtualizer;import com.jasper.bean.ModelTableSource;
import com.jasper.bean.Users;@WebServlet("/JasperServlet9")
public class JasperServlet9 extends HttpServlet {private static final long serialVersionUID = 1L;public JasperServlet9() {super();}protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {Map<String,Object> parameters = new HashMap<String,Object>(16);String pageStr = request.getParameter("page");HttpSession session = request.getSession();int pageIndex = 0;int lastPageIndex = 0;//list数据源List<Users> list = new ArrayList<Users>();for(int i = 1 ; i <= 50 ; i++) {Users users = new Users(i,"name"+i,"grade"+i,"college"+i,"mobile"+i);list.add(users);}ModelTableSource mts = new ModelTableSource();mts.setDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));mts.setTableData(new JRBeanCollectionDataSource(list));List<ModelTableSource> mlist = new ArrayList<ModelTableSource>();mlist.add(mts);String jrxmlPath = request.getServletContext().getRealPath("/")+"/jrxml/DemoReport9.jrxml";//由jrxml文件编译后生产jasper文件的路径String jasperPath = request.getServletContext().getRealPath("/")+"/jasper/DemoReport9.jasper";PrintWriter out = null;try {//编译jrxml生产jasper文件JasperCompileManager.compileReportToFile(jrxmlPath, jasperPath);//JasperPrint将数据全部取出,放到session中JasperPrint jasperPrint = (JasperPrint) session.getAttribute("jasperPrint");if(null == jasperPrint) {jasperPrint = this.getJasperPrint(jasperPath, parameters, mlist);session.setAttribute("jasperPrint", jasperPrint);}if(null != jasperPrint.getPages()) {lastPageIndex = jasperPrint.getPages().size() - 1;}if(null == pageStr) {pageStr = "0";}try {pageIndex = Integer.valueOf(pageStr);if(pageIndex > 0) {pageIndex = pageIndex -1 ;}} catch (Exception e) {// 如果得到的非数字字符串if("lastPage".equals(pageStr)) {pageIndex = lastPageIndex;}}if (pageIndex < 0) {pageIndex = 0;}if (pageIndex > lastPageIndex) {pageIndex = lastPageIndex;}//将html输出到浏览器上JRHtmlExporter exporter = new JRHtmlExporter();response.setCharacterEncoding("UTF-8");out = response.getWriter();//分页exporter.setParameter(JRExporterParameter.PAGE_INDEX, pageIndex);exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);exporter.exportReport();} catch (Exception e) {e.printStackTrace();}finally {out.flush();out.close();}}private JasperPrint getJasperPrint(String jasperPath, Map<String, Object> parameters, List<?> list) throws JRException {//解决大数据量保留在内存中,只在内存中保留两页,剩下的放入磁盘中JRFileVirtualizer virtualizer = new JRFileVirtualizer(2, "D:/");parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);virtualizer.setReadOnly(true);return JasperFillManager.fillReport(jasperPath, parameters, new JRBeanCollectionDataSource(list));	 }protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doGet(request, response);}}

ModelTableSource.java

package com.jasper.bean;import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;public class ModelTableSource {/*** 注入table组件的数据源*/private JRBeanCollectionDataSource tableData;/*** 当前时间(查询时间)*/private String date;public JRBeanCollectionDataSource getTableData() {return tableData;}public void setTableData(JRBeanCollectionDataSource tableData) {this.tableData = tableData;}public String getDate() {return date;}public void setDate(String date) {this.date = date;}}

Users.java

package com.jasper.bean;public class Users {private Integer userId;private String userName;private String grade;private String college;private String mobile;public Integer getUserId() {return userId;}public void setUserId(Integer userId) {this.userId = userId;}public String getUserName() {return userName;}public void setUserName(String userName) {this.userName = userName;}public String getGrade() {return grade;}public void setGrade(String grade) {this.grade = grade;}public String getCollege() {return college;}public void setCollege(String college) {this.college = college;}public String getMobile() {return mobile;}public void setMobile(String mobile) {this.mobile = mobile;}public Users(Integer userId, String userName, String grade, String college, String mobile) {super();this.userId = userId;this.userName = userName;this.grade = grade;this.college = college;this.mobile = mobile;}public Users() {super();}}

 代码下载:https://download.csdn.net/download/u013456370/10588521

这篇关于Jasperreports+jaspersoft studio学习教程(八)- 报表分页和大量数据内存处理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1146936

相关文章

windos server2022的配置故障转移服务的图文教程

《windosserver2022的配置故障转移服务的图文教程》本文主要介绍了windosserver2022的配置故障转移服务的图文教程,以确保服务和应用程序的连续性和可用性,文中通过图文介绍的非... 目录准备环境:步骤故障转移群集是 Windows Server 2022 中提供的一种功能,用于在多个

Java内存泄漏问题的排查、优化与最佳实践

《Java内存泄漏问题的排查、优化与最佳实践》在Java开发中,内存泄漏是一个常见且令人头疼的问题,内存泄漏指的是程序在运行过程中,已经不再使用的对象没有被及时释放,从而导致内存占用不断增加,最终... 目录引言1. 什么是内存泄漏?常见的内存泄漏情况2. 如何排查 Java 中的内存泄漏?2.1 使用 J

Python MySQL如何通过Binlog获取变更记录恢复数据

《PythonMySQL如何通过Binlog获取变更记录恢复数据》本文介绍了如何使用Python和pymysqlreplication库通过MySQL的二进制日志(Binlog)获取数据库的变更记录... 目录python mysql通过Binlog获取变更记录恢复数据1.安装pymysqlreplicat

Linux使用dd命令来复制和转换数据的操作方法

《Linux使用dd命令来复制和转换数据的操作方法》Linux中的dd命令是一个功能强大的数据复制和转换实用程序,它以较低级别运行,通常用于创建可启动的USB驱动器、克隆磁盘和生成随机数据等任务,本文... 目录简介功能和能力语法常用选项示例用法基础用法创建可启动www.chinasem.cn的 USB 驱动

Oracle数据库使用 listagg去重删除重复数据的方法汇总

《Oracle数据库使用listagg去重删除重复数据的方法汇总》文章介绍了在Oracle数据库中使用LISTAGG和XMLAGG函数进行字符串聚合并去重的方法,包括去重聚合、使用XML解析和CLO... 目录案例表第一种:使用wm_concat() + distinct去重聚合第二种:使用listagg,

龙蜥操作系统Anolis OS-23.x安装配置图解教程(保姆级)

《龙蜥操作系统AnolisOS-23.x安装配置图解教程(保姆级)》:本文主要介绍了安装和配置AnolisOS23.2系统,包括分区、软件选择、设置root密码、网络配置、主机名设置和禁用SELinux的步骤,详细内容请阅读本文,希望能对你有所帮助... ‌AnolisOS‌是由阿里云推出的开源操作系统,旨

Go语言使用Buffer实现高性能处理字节和字符

《Go语言使用Buffer实现高性能处理字节和字符》在Go中,bytes.Buffer是一个非常高效的类型,用于处理字节数据的读写操作,本文将详细介绍一下如何使用Buffer实现高性能处理字节和... 目录1. bytes.Buffer 的基本用法1.1. 创建和初始化 Buffer1.2. 使用 Writ

PyTorch使用教程之Tensor包详解

《PyTorch使用教程之Tensor包详解》这篇文章介绍了PyTorch中的张量(Tensor)数据结构,包括张量的数据类型、初始化、常用操作、属性等,张量是PyTorch框架中的核心数据结构,支持... 目录1、张量Tensor2、数据类型3、初始化(构造张量)4、常用操作5、常用属性5.1 存储(st

Python实现将实体类列表数据导出到Excel文件

《Python实现将实体类列表数据导出到Excel文件》在数据处理和报告生成中,将实体类的列表数据导出到Excel文件是一项常见任务,Python提供了多种库来实现这一目标,下面就来跟随小编一起学习一... 目录一、环境准备二、定义实体类三、创建实体类列表四、将实体类列表转换为DataFrame五、导出Da

Python视频处理库VidGear使用小结

《Python视频处理库VidGear使用小结》VidGear是一个高性能的Python视频处理库,本文主要介绍了Python视频处理库VidGear使用小结,文中通过示例代码介绍的非常详细,对大家的... 目录一、VidGear的安装二、VidGear的主要功能三、VidGear的使用示例四、VidGea