java: itext8.05 create pdf
只能调用windows 已安装的字体,这样可以在系统中先预装字体,5.0 可以调用自配文件夹的字体文件。CSharp donetItext8.0 可以调用。
/*** encoding: utf-8* 版权所有 2024 ©涂聚文有限公司 言語成了邀功盡責的功臣,還需要行爲每日來值班嗎* 许可信息查看: https://github.com/itext/itext-publications-examples-java/blob/develop/src/main/java/com/itextpdf/samples/sandbox/fonts/FreeSansBold.java* 描述:https://mvnrepository.com/artifact/com.itextpdf/kernel* # Author : geovindu,Geovin Du 涂聚文.* # IDE : IntelliJ IDEA 2023.1 Java 17* # Datetime : 2024 - 2024/11/20 - 20:13* # User : geovindu* # Product : IntelliJ IDEA* # Project : EssentialAlgorithms itext8.05* # File : SimpleItext.java* # explain : 学习 类**/package BLL;//import java.awt.*;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import com.itextpdf.io.font.PdfEncodings;
import com.itextpdf.io.font.TrueTypeFont;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.colors.Color;
import com.itextpdf.kernel.colors.*;
import com.itextpdf.kernel.colors.gradients.*;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.font.*;
import com.itextpdf.kernel.pdf.*;
import com.itextpdf.kernel.pdf.canvas.draw.*;
import com.itextpdf.io.image.ImageData;
import com.itextpdf.io.image.ImageDataFactory;
import com.itextpdf.io.font.FontProgramFactory;
import com.itextpdf.layout.element.*;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.borders.Border;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.element.Image;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.element.Table;
import com.itextpdf.layout.properties.TextAlignment;
import com.itextpdf.layout.properties.UnitValue;
import com.itextpdf.layout.properties.VerticalAlignment;
import com.itextpdf.layout.properties.HorizontalAlignment;
import com.itextpdf.layout.element.Text;
import com.itextpdf.layout.borders.*;
import com.itextpdf.layout.borders.SolidBorder;
import com.itextpdf.io.util.StreamUtil;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;import java.io.File;
import java.util.HashSet;
import java.util.Set;
import java.io.FileInputStream;
import java.nio.file.Files;
import java.nio.file.Paths;import Model.Orders;public class SimpleItext {private static String USER_PASSWORD = "geovindu";private static String OWNER_PASSWORD = "geovindu";public static final String FONTDIR = "font/";public void test(){try {String fontFile2 = "font/MHeiHK-Light.TTF";String path = "C:/WINDOWS/Fonts/simhei.ttf";//windows里的字体资源路径String getfont="";// Creating a PdfWriter objectString dest = "coloredBorders.pdf";//PdfFont pfont=null;PdfWriter writer = new PdfWriter(dest);// Creating a PdfDocument objectPdfDocument pdfDoc = new PdfDocument(writer);// Creating a Document objectDocument doc = new Document(pdfDoc);PdfFontFactory.registerDirectory(FONTDIR);byte[] bytes;FileInputStream myflie = new FileInputStream(fontFile2);//var is = getClass().getResourceAsStream(fontFile2);bytes = StreamUtil.inputStreamToArray(myflie);//byte[] tem = new byte[myflie.available()];//创建一个长度为myflie长的竹筒//myflie.read(tem);//var pfont = FontProgramFactory.createFont(bytes);//PdfFont pfont = PdfFontFactory.createFont(bytes, PdfEncodings.UTF8);/*Set<String> fonts = new HashSet<String>(FontProgramFactory.getRegisteredFonts());for (String fontname : fonts) {System.out.print(fontname);getfont=fontname;pfont = PdfFontFactory.createRegisteredFont(getfont, PdfEncodings.IDENTITY_H);doc.add(new Paragraph(String.format("Postscript name for %s: %s", getfont,pfont.getFontProgram().getFontNames().getFontName())));}*///PdfFont f2 = PdfFontFactory.createFont("STSong-Light", "UniGB-UCS2-H");PdfFont pfont = PdfFontFactory.createFont(path, PdfEncodings.IDENTITY_H);//PdfFontFactory.EmbeddingStrategy.FORCE_EMBEDDED// Creating a tablefloat[] pointColumnWidths = {200F, 200F};Table table = new Table(pointColumnWidths);// Adding row 1 to the tableCell c1 = new Cell();// Adding the contents of the cellc1.add(new Paragraph("Name").setFont(pfont));// Setting the back ground color of the cellc1.setBackgroundColor(ColorConstants.DARK_GRAY);// Instantiating the Border classBorder b1 = new DashedBorder(ColorConstants.RED, 3);// Setting the border of the cellc1.setBorder(b1);// Setting the text alignmentc1.setTextAlignment(TextAlignment.CENTER);// Adding the cell to the tabletable.addCell(c1);Cell c2 = new Cell();c2.add(new Paragraph("涂聚文").setFont(pfont));c1.setBorder(new SolidBorder(ColorConstants.RED, 3));c2.setTextAlignment(TextAlignment.CENTER);table.addCell(c2);// Adding row 2 to the tableCell c3 = new Cell();c3.add(new Paragraph("Id").setFont(pfont));c3.setBorder(new DottedBorder(ColorConstants.DARK_GRAY, 3));c3.setTextAlignment(TextAlignment.CENTER);table.addCell(c3);Cell c4 = new Cell();c4.add(new Paragraph("001").setFont(pfont));c4.setBorder(new DoubleBorder(ColorConstants.DARK_GRAY, 3));c4.setTextAlignment(TextAlignment.CENTER);table.addCell(c4);// Adding row 3 to the tableCell c5 = new Cell();c5.add(new Paragraph("Designation").setFont(pfont));c5.setBorder(new RoundDotsBorder(ColorConstants.RED, 3));c5.setTextAlignment(TextAlignment.CENTER);table.addCell(c5);Cell c6 = new Cell();c6.add(new Paragraph("Programmer").setFont(pfont));c6.setBorder(new RoundDotsBorder(ColorConstants.RED, 3));c6.setTextAlignment(TextAlignment.CENTER);table.addCell(c6);// Adding Table to documentdoc.add(table);// Closing the documentdoc.close();System.out.println("Borders added successfully..");}catch(IOException oex){oex.printStackTrace();}catch (Exception ex){ex.printStackTrace();}}public void Createpdf(){try{String dem="itextExample.pdf";PdfWriter writer =new PdfWriter(dem);//设置打开文档必码// writer.setEncryption(USER_PASSWORD.getBytes(),//OWNER_PASSWORD.getBytes(), PdfWriter.ALLOW_PRINTING,//PdfWriter.ENCRYPTION_AES_128);String fontFile2 = "font\\MHeiHK-Light.TTF"; // 这个报错: Type of font is not recognizedString path = "C:/WINDOWS/Fonts/simhei.ttf";//windows里的字体资源路径//PdfFont f2 = PdfFontFactory.createFont("STSong-Light", "UniGB-UCS2-H");PdfFont pfont = PdfFontFactory.createFont(path, PdfEncodings.IDENTITY_H);//PdfFontFactory.EmbeddingStrategy.FORCE_EMBEDDED//PdfFont pfont = PdfFontFactory.createRegisteredFont(path, PdfEncodings.IDENTITY_H);PdfDocument pdfDoc = new PdfDocument(writer);Document document = new Document(pdfDoc);//document.setFont(pfont);//document.open();document.add(new Paragraph("Some content here").setFont(pfont).setFontColor(ColorConstants.RED));//Set attributes here//document.("Geovin Du 涂聚文");// document.addCreationDate();//document.addCreator("dusystem.com");//document.addTitle("Set Attribute Example");//document.addSubject("An example to show how attributes can be added to pdf files.");Table table = new Table(3,true); // 3 columns.//table.setHeight(100); //Width 100%//table.setHeight(10f); //Space before table//table.setSpacingAfter(10f); //Space after table//Set Column widths//float[] columnWidths = {1f, 1f, 1f};//table.setHeight(columnWidths);Cell cell1 = new Cell().add(new Paragraph("深圳市").setFont(pfont));cell1.setBorder(new SolidBorder(ColorConstants.BLACK, 1));cell1.setPaddingLeft(10);cell1.setHorizontalAlignment(HorizontalAlignment.CENTER);cell1.setVerticalAlignment(VerticalAlignment.MIDDLE);Cell cell2 = new Cell().add(new Paragraph("南山區").setFont(pfont).setFontColor(ColorConstants.GREEN));cell2.setBorder(new SolidBorder(ColorConstants.BLACK, 1));cell2.setPaddingLeft(10);cell2.setHorizontalAlignment(HorizontalAlignment.LEFT);cell2.setVerticalAlignment(VerticalAlignment.MIDDLE);//.setVerticalAlignment(VerticalAlignment.MIDDLE)Cell cell3 = new Cell().add(new Paragraph("科技園").setFont(pfont));cell3.setBackgroundColor(ColorConstants.RED);cell3.setPaddingLeft(10);cell3.setHorizontalAlignment(HorizontalAlignment.CENTER);cell3.setVerticalAlignment(VerticalAlignment.MIDDLE);table.addCell(cell1);table.addCell(cell2);table.addCell(cell3);// table.complete();document.add(table);List<Orders> orders = new ArrayList<>();Orders order = new Orders();order.setProductId(1); ;order.setProduct("中國電器");order.setQty(50);order.setPrice(52.0);orders.add(order);order = new Orders();order.setProductId(2);order.setProduct ("日本電器");order.setQty(150);order.setPrice(252.0);orders.add(order);//2Table tableData = new Table(5, true);tableData.setBorder(new SolidBorder(ColorConstants.BLACK, 1));tableData.setFont(pfont);Cell headerProductId = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph("ID"));Cell headerProduct = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph("產品名稱"));Cell headerProductPrice = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph("價格"));Cell headerProductQty = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph("數量"));Cell headerTotal = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph("合計"));tableData.addCell(headerProductId);tableData.addCell(headerProduct);tableData.addCell(headerProductPrice);tableData.addCell(headerProductQty);tableData.addCell(headerTotal);double grandTotalVal = 0;for(Orders c:orders){Cell productid = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph(String.valueOf(c.getProductId())));Cell product = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph(c.getProduct()));Cell price = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph(String.valueOf(c.getPrice())));Cell qty = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph(String.valueOf(c.getQty())));var value = c.getPrice() * c.getQty();Cell total = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph(String.valueOf(value)));grandTotalVal += value;tableData.addCell(productid);tableData.addCell(product);tableData.addCell(price);tableData.addCell(qty);tableData.addCell(total);}Cell grandTotalHeader = new Cell(1, 4).setTextAlignment(TextAlignment.RIGHT).add(new Paragraph("合計: ")).setBorderBottom(new SolidBorder(ColorConstants.BLACK, 1));Cell grandTotal = new Cell(1, 1).setTextAlignment(TextAlignment.LEFT).add(new Paragraph(" " + String.valueOf(grandTotalVal))).setBorderBottom(new SolidBorder(ColorConstants.BLACK, 1));grandTotal.setBorderBottom(new SolidBorder(ColorConstants.BLACK, 1));tableData.addCell(grandTotalHeader);tableData.addCell(grandTotal);//tableData.complete();document.add(tableData);Table tablebottom = new Table(4,true);//tablebottom.setBorder(new SolidBorder(ColorConstants.BLACK, 3));tablebottom.setHorizontalAlignment(HorizontalAlignment.CENTER);tablebottom.addCell(new Cell().add(new Paragraph("產品ID").setFont(pfont)).setBorderTop(new SolidBorder(ColorConstants.BLACK, 3)));tablebottom.addCell(new Cell().add(new Paragraph("名稱").setFont(pfont)).setBorderTop(new SolidBorder(ColorConstants.BLACK, 3)));tablebottom.addCell(new Cell().add(new Paragraph("書量").setFont(pfont)).setBorderTop(new SolidBorder(ColorConstants.BLACK, 3)));tablebottom.addCell(new Cell().add(new Paragraph("價格").setFont(pfont)).setBorderTop(new SolidBorder(ColorConstants.BLACK, 3)));//table.setHeaderRows(1);//Cell[] cells = table.getCell(2,3);//for (int j=0;j<cells.length;j++){//cells[j].setBackgroundColor(ColorConstants.BLACK);//}for (Orders s:orders){Cell cel1= new Cell().add(new Paragraph(String.valueOf(s.getProductId()))).setBorder(new SolidBorder(ColorConstants.BLACK, 3));cel1.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel1);Cell cel2=new Cell().add(new Paragraph(s.getProduct()).setFont(pfont)).setBorder(new SolidBorder(ColorConstants.BLACK, 3));cel2.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel2);Cell cel3=new Cell().add(new Paragraph(String.valueOf(s.getQty()))).setBorder(new SolidBorder(ColorConstants.BLACK, 3));cel3.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel3);Cell cel4=new Cell().add(new Paragraph(String.valueOf(s.getPrice()))).setBorder(new SolidBorder(ColorConstants.BLACK, 3));cel4.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel4);}Cell cel1= new Cell().add(new Paragraph("3").setBorderBottom(new SolidBorder(ColorConstants.BLACK, 3)));cel1.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel1);Cell cel2=new Cell().add(new Paragraph("涂聚文").setFont(pfont).setBorderBottom(new SolidBorder(ColorConstants.BLACK, 3)).setBorderLeft(new SolidBorder(ColorConstants.BLACK, 3)));cel2.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel2);Cell cel3=new Cell().add(new Paragraph("333").setBorderBottom(new SolidBorder(ColorConstants.BLACK, 3)).setBorderLeft(new SolidBorder(ColorConstants.BLACK, 3)));cel3.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel3);Cell cel4=new Cell().add(new Paragraph("3333").setBorderBottom(new SolidBorder(ColorConstants.BLACK, 3)).setBorderLeft(new SolidBorder(ColorConstants.BLACK, 3)));cel4.setTextAlignment(TextAlignment.CENTER);tablebottom.addCell(cel4);document.add(tablebottom);ImageData imageData = ImageDataFactory.create("geovindu.jpg");Image image1 = new Image(imageData);//Fixed Positioning//image1.setAbsolutePosition(205f, 150f);//Scale to new height and new width of imageimage1.scaleAbsolute(100, 100);//Add to documentdocument.add(image1);document.close();writer.close();} catch (Exception e){e.printStackTrace();}}}
调用:
//SimpleItext itextpdf=new SimpleItext();//itextpdf.test();itextpdf.Createpdf();
相关文章:

java: itext8.05 create pdf
只能调用windows 已安装的字体,这样可以在系统中先预装字体,5.0 可以调用自配文件夹的字体文件。CSharp donetItext8.0 可以调用。 /*** encoding: utf-8* 版权所有 2024 ©涂聚文有限公司 言語成了邀功盡責的功臣,還需要行爲每日來值班…...
如何用通义灵码快速绘制流程图?
使用通义灵码快速绘制流程图?新功能体验 不想读前人“骨灰级”代码,不想当“牛马”程序员,想像看图片一样快速读复杂代码和架构? 通义灵码已经支持代码逻辑可视化,可以把你的每段代码画成流程图。像个脑图工具一样帮你…...

vue 预览pdf 【@sunsetglow/vue-pdf-viewer】开箱即用,无需开发
sunsetglow/vue-pdf-viewer 开箱即用的pdf插件sunsetglow/vue-pdf-viewer, vue3 版本 无需多余开发,操作简单,支持大文件 pdf 滚动加载,缩放,左侧导航,下载,页码,打印,文本复制&…...

Java NIO 核心知识总结
在学习 NIO 之前,需要先了解一下计算机 I/O 模型的基础理论知识。还不了解的话,可以参考我写的这篇文章:Java IO 模型详解。 一、NIO 简介 在传统的 Java I/O 模型(BIO)中,I/O 操作是以阻塞的方式进行的。…...

疑难Tips:NextCloud域名访问登录时卡住,显示违反内容安全策略
[ 知识是人生的灯塔,只有不断学习,才能照亮前行的道路 ] 1使用域名访问Nextcloud用户登录时卡住,显示违反内容安全策略 我使用官方Docker镜像来部署NextCloud 28.0.5,并通过Openresty反向代理Nextcloud,但是在安装后无法稳定工作,每次登录后,页面会卡死在登录界面,无法…...

C 语言学习-06【指针】
1、目标单元与简介存取 直接访问和间接访问 #include <stdio.h>int main(void) {int a 3, *p;p &a;printf("a %d, *p %d\n", a, *p);*p 10;printf("a %d, *p %d\n", a, *p);printf("Enter a: ");scanf("%d", &a)…...

如何快速将Excel数据导入到SQL Server数据库
工作中,我们经常需要将Excel数据导入到数据库,但是对于数据库小白来说,这可能并非易事;对于数据库专家来说,这又可能非常繁琐。 这篇文章将介绍如何帮助您快速的将Excel数据导入到sql server数据库。 准备工作 这里&…...

【人工智能】Python在机器学习与人工智能中的应用
Python因其简洁易用、丰富的库支持以及强大的社区,被广泛应用于机器学习与人工智能(AI)领域。本教程通过实用的代码示例和讲解,带你从零开始掌握Python在机器学习与人工智能中的基本用法。 1. 机器学习与AI的Python生态系统 Pyth…...

使用八爪鱼爬虫抓取汽车网站数据,分析舆情数据
我是做汽车行业的,可以用八爪鱼爬虫抓取汽车之家和微博上的汽车文章内容,分析各种电动汽车口碑数据。 之前,我写过很多Python网络爬虫的案例,使用requests、selenium等技术采集数据,这次尝试去采集小米SU7在微博、汽车…...
什么是事务?事务有哪些特性?
在数据库管理中,事务是一个核心概念,它确保了数据操作的完整性和一致性。本文将探讨事务的定义及其四大特性。 一、事务的定义 事务是数据库操作的最小工作单元,是作为单个逻辑工作单元执行的一系列操作。这些操作作为一个整体一起向系统提…...
玩转合宙Luat教程 基础篇④——程序基础(库、线程、定时器和订阅/发布)
文章目录 一、前言二、库三、线程四、定时器五、订阅/发布5.1 回调函数5.2 堵塞等待一、前言 教程目录大纲请查阅:玩转合宙Luat教程——导读 写一写Lua程序基础的东西。 包括如何调用库,如何创建线程、如何创建定时器,如何使用订阅/发布事件。 二、库 程序从main.lua开始通…...

24.<Spring博客系统①(数据库+公共代码+持久层+显示博客列表+博客详情)>
项目整体预览 登录页面 主页 查看全文 编辑 写博客 PS:Service.impl(现在流行写法) 推荐写法。后续完成项目。会尝试这样写。 接口可以有多个实现。每个实现都可以不同。 这也算一种设计模式。叫做(策略模式)。 我们…...

webp 网页如何录屏?
工作中正好研究到了一点:记录下这里: 先看下效果: 具体实现代码:  <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta name"viewport&qu…...

丹摩征文活动|实现Llama3.1大模型的本地部署
文章目录 1.前言2.丹摩的配置3.Llama3.1的本地配置4. 最终界面 丹摩 1.前言 Llama3.1是Meta 公司发布的最新开源大型语言模型,相较于之前的版本,它在规模和功能上实现了显著提升,尤其是最大的 4050亿参数版本,成为开源社区中非常…...
Spring Boot 2 和 Spring Boot 3 中使用 Spring Security 的区别
文章目录 Spring Boot 2 和 Spring Boot 3 中使用 Spring Security 的区别1. Jakarta EE 迁移2. Spring Security 配置方式的变化3. PasswordEncoder 加密方式的变化4. permitAll() 和 authenticated() 的变化5. 更强的默认安全设置6. Java 17 支持与语法提升7. PreAuthorize、…...

【数据结构与算法】 LeetCode:回溯
文章目录 回溯算法组合组合总和(Hot 100)组合总和 II电话号码的字母组合(Hot 100)括号生成(Hot 100)分割回文串(Hot 100)复原IP地址子集(Hot 100)全排列&…...
SpringBoot线程池的使用
SpringBoot线程池的使用 在现代Web应用开发中,特别是在使用Spring Boot框架时,合理使用线程池可以显著提高应用的性能和响应速度。线程池不仅能够减少线程创建和销毁的开销,还能有效地控制并发任务的数量,避免因线程过多而导致的…...

Neural Magic 发布 LLM Compressor:提升大模型推理效率的新工具
每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗?订阅我们的简报,深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同,从行业内部的深度分析和实用指南中受益。不要错过这个机会,成为AI领…...
HttpServletRequest req和前端的关系,req.getParameter详细解释,req.getParameter和前端的关系
HttpServletRequest 对象在后端和前端之间起到了桥梁的作用,它包含了来自客户端的所有请求信息。通过 HttpServletRequest 对象,后端可以获取前端发送的请求参数、请求头、请求方法等信息,并根据这些信息进行相应的处理。以下是对 HttpServle…...
React-useEffect的使用
useEffect react提供的一个常用hook,用于在函数组件中执行副作用操作,比如数据获取、订阅或手动更改DOM。 基本用法: 接受2个参数: 一个包含命令式代码的函数(副作用函数)。一个依赖项数组,用…...

简易版抽奖活动的设计技术方案
1.前言 本技术方案旨在设计一套完整且可靠的抽奖活动逻辑,确保抽奖活动能够公平、公正、公开地进行,同时满足高并发访问、数据安全存储与高效处理等需求,为用户提供流畅的抽奖体验,助力业务顺利开展。本方案将涵盖抽奖活动的整体架构设计、核心流程逻辑、关键功能实现以及…...
Nginx server_name 配置说明
Nginx 是一个高性能的反向代理和负载均衡服务器,其核心配置之一是 server 块中的 server_name 指令。server_name 决定了 Nginx 如何根据客户端请求的 Host 头匹配对应的虚拟主机(Virtual Host)。 1. 简介 Nginx 使用 server_name 指令来确定…...

uniapp微信小程序视频实时流+pc端预览方案
方案类型技术实现是否免费优点缺点适用场景延迟范围开发复杂度WebSocket图片帧定时拍照Base64传输✅ 完全免费无需服务器 纯前端实现高延迟高流量 帧率极低个人demo测试 超低频监控500ms-2s⭐⭐RTMP推流TRTC/即构SDK推流❌ 付费方案 (部分有免费额度&#x…...
python报错No module named ‘tensorflow.keras‘
是由于不同版本的tensorflow下的keras所在的路径不同,结合所安装的tensorflow的目录结构修改from语句即可。 原语句: from tensorflow.keras.layers import Conv1D, MaxPooling1D, LSTM, Dense 修改后: from tensorflow.python.keras.lay…...
【Go语言基础【13】】函数、闭包、方法
文章目录 零、概述一、函数基础1、函数基础概念2、参数传递机制3、返回值特性3.1. 多返回值3.2. 命名返回值3.3. 错误处理 二、函数类型与高阶函数1. 函数类型定义2. 高阶函数(函数作为参数、返回值) 三、匿名函数与闭包1. 匿名函数(Lambda函…...

RabbitMQ入门4.1.0版本(基于java、SpringBoot操作)
RabbitMQ 一、RabbitMQ概述 RabbitMQ RabbitMQ最初由LShift和CohesiveFT于2007年开发,后来由Pivotal Software Inc.(现为VMware子公司)接管。RabbitMQ 是一个开源的消息代理和队列服务器,用 Erlang 语言编写。广泛应用于各种分布…...

Linux nano命令的基本使用
参考资料 GNU nanoを使いこなすnano基础 目录 一. 简介二. 文件打开2.1 普通方式打开文件2.2 只读方式打开文件 三. 文件查看3.1 打开文件时,显示行号3.2 翻页查看 四. 文件编辑4.1 Ctrl K 复制 和 Ctrl U 粘贴4.2 Alt/Esc U 撤回 五. 文件保存与退出5.1 Ctrl …...

论文阅读:LLM4Drive: A Survey of Large Language Models for Autonomous Driving
地址:LLM4Drive: A Survey of Large Language Models for Autonomous Driving 摘要翻译 自动驾驶技术作为推动交通和城市出行变革的催化剂,正从基于规则的系统向数据驱动策略转变。传统的模块化系统受限于级联模块间的累积误差和缺乏灵活性的预设规则。…...
在golang中如何将已安装的依赖降级处理,比如:将 go-ansible/v2@v2.2.0 更换为 go-ansible/@v1.1.7
在 Go 项目中降级 go-ansible 从 v2.2.0 到 v1.1.7 具体步骤: 第一步: 修改 go.mod 文件 // 原 v2 版本声明 require github.com/apenella/go-ansible/v2 v2.2.0 替换为: // 改为 v…...
用 Rust 重写 Linux 内核模块实战:迈向安全内核的新篇章
用 Rust 重写 Linux 内核模块实战:迈向安全内核的新篇章 摘要: 操作系统内核的安全性、稳定性至关重要。传统 Linux 内核模块开发长期依赖于 C 语言,受限于 C 语言本身的内存安全和并发安全问题,开发复杂模块极易引入难以…...