C# Windows Forms应用程序-001

目录

项目概述

主要组件及功能

类定义

控件声明

构造函数

Dispose 方法

InitializeComponents 方法

控件配置详解

Button 控件 (button1)

TextBox 控件 (textBox1)

GroupBox 控件 (groupBox1)

Label 控件 (label1 至 label5)

OpenFileDialog 控件 (openFileDialog1)

Button 控件 (button2)

Label 控件 (label6)

Button 控件 (button3)

窗体配置

事件处理方法

浏览程序文件 (button1_Click)

获取程序文件信息 (button2_Click)

获取本程序文件信息 (button3_Click)

项目截图:

项目完整源码:


项目概述

这是一个简单的C# Windows Forms应用程序,展示了如何通过用户界面与文件系统进行交互,并利用.NET框架提供的API来获取文件的元数据,用于浏览和获取程序文件的信息。具体功能包括:

  1. 浏览程序文件:允许用户通过文件对话框选择一个.exe文件。
  2. 获取并显示程序文件信息:一旦选择了文件,应用程序会读取并显示该文件的详细信息,如公司名称、产品名称、语言标志、版本号和版权声明。
  3. 获取当前程序文件信息:还可以显示当前运行的应用程序本身的详细信息。
  4. 创建窗体和控件:
    • 定义窗体类 Form1 并添加各种控件(按钮、文本框、分组框、标签等)。
    • 在 InitializeComponent 方法中配置每个控件的位置、大小、文本和其他属性。
  5. 事件绑定:
    • 为每个按钮绑定点击事件处理方法。
    • button1_Click: 打开文件对话框并显示选中的文件路径。
    • button2_Click: 获取并显示所选文件的详细信息。
    • button3_Click: 获取并显示所选的应用程序本身的详细信息。

主要组件及功能

类定义

public class Form1 : System.Windows.Forms.Form
  • Form1继承自System.Windows.Forms.Form,是整个应用程序的主要窗体类。

控件声明

private Button button1;
private TextBox textBox1;
private GroupBox groupBox1;
private OpenFileDialog openFileDialog1;
private Button button2;
private Label label1;
private Label label2;
private Label label3;
private Label label4;
private Label label5;
private Label label6;
private Button button3;
  • Button: 提供用户交互按钮。
  • TextBox: 显示选定文件路径。
  • GroupBox: 包含多个标签用于显示文件信息。
  • OpenFileDialog: 文件打开对话框,用于让用户选择文件。
  • Label: 标签控件,用于显示文本信息。

构造函数

public Form1()
{InitializeComponent();
}
  • 初始化窗体及其所有子控件。

Dispose 方法

protected override void Dispose(bool disposing)
{if (disposing && components != null){components.Dispose();}base.Dispose(disposing);
}
  • 清理所有正在使用的资源。

InitializeComponents 方法

此方法由Visual Studio设计器生成,用于初始化窗体上的各个控件及其属性。

private void InitializeComponent()
{this.button1 = new System.Windows.Forms.Button();this.textBox1 = new System.Windows.Forms.TextBox();this.groupBox1 = new System.Windows.Forms.GroupBox();this.label5 = new System.Windows.Forms.Label();this.label4 = new System.Windows.Forms.Label();this.label3 = new System.Windows.Forms.Label();this.label2 = new System.Windows.Forms.Label();this.label1 = new System.Windows.Forms.Label();this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();this.button2 = new System.Windows.Forms.Button();this.label6 = new System.Windows.Forms.Label();this.button3 = new System.Windows.Forms.Button();this.groupBox1.SuspendLayout();this.SuspendLayout();// // button1// this.button1.Location = new System.Drawing.Point(41, 48);this.button1.Name = "button1";this.button1.Size = new System.Drawing.Size(112, 23);this.button1.TabIndex = 1;this.button1.Text = "浏览程序文件";this.button1.Click += new System.EventHandler(this.button1_Click);// // textBox1// this.textBox1.BackColor = System.Drawing.SystemColors.Control;this.textBox1.Location = new System.Drawing.Point(276, 112);this.textBox1.Name = "textBox1";this.textBox1.ReadOnly = true;this.textBox1.Size = new System.Drawing.Size(256, 21);this.textBox1.TabIndex = 2;// // groupBox1// this.groupBox1.Controls.Add(this.label5);this.groupBox1.Controls.Add(this.label4);this.groupBox1.Controls.Add(this.label3);this.groupBox1.Controls.Add(this.label2);this.groupBox1.Controls.Add(this.label1);this.groupBox1.Location = new System.Drawing.Point(41, 187);this.groupBox1.Name = "groupBox1";this.groupBox1.Size = new System.Drawing.Size(602, 236);this.groupBox1.TabIndex = 3;this.groupBox1.TabStop = false;this.groupBox1.Text = "程序文件信息";// // label5// this.label5.Location = new System.Drawing.Point(28, 197);this.label5.Name = "label5";this.label5.Size = new System.Drawing.Size(320, 16);this.label5.TabIndex = 4;this.label5.Text = "版权声明:";// // label4// this.label4.Location = new System.Drawing.Point(28, 160);this.label4.Name = "label4";this.label4.Size = new System.Drawing.Size(320, 16);this.label4.TabIndex = 3;this.label4.Text = "版本号:";// // label3// this.label3.Location = new System.Drawing.Point(28, 125);this.label3.Name = "label3";this.label3.Size = new System.Drawing.Size(320, 16);this.label3.TabIndex = 2;this.label3.Text = "语言标志:";// // label2// this.label2.Location = new System.Drawing.Point(28, 81);this.label2.Name = "label2";this.label2.Size = new System.Drawing.Size(320, 16);this.label2.TabIndex = 1;this.label2.Text = "产品名称:";// // label1// this.label1.Location = new System.Drawing.Point(28, 28);this.label1.Name = "label1";this.label1.Size = new System.Drawing.Size(320, 16);this.label1.TabIndex = 0;this.label1.Text = "公司名称:";// // openFileDialog1// this.openFileDialog1.Filter = "程序文件(*.exe)|*.exe|All files (*.*)|*.*";// // button2// this.button2.Location = new System.Drawing.Point(277, 48);this.button2.Name = "button2";this.button2.Size = new System.Drawing.Size(112, 23);this.button2.TabIndex = 11;this.button2.Text = "获取程序文件信息";this.button2.Click += new System.EventHandler(this.button2_Click);// // label6// this.label6.Location = new System.Drawing.Point(130, 117);this.label6.Name = "label6";this.label6.Size = new System.Drawing.Size(96, 16);this.label6.TabIndex = 12;this.label6.Text = "程序文件名称:";// // button3// this.button3.Location = new System.Drawing.Point(515, 48);this.button3.Name = "button3";this.button3.Size = new System.Drawing.Size(128, 23);this.button3.TabIndex = 13;this.button3.Text = "获取本程序文件信息";this.button3.Click += new System.EventHandler(this.button3_Click);// // Form1// this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);this.ClientSize = new System.Drawing.Size(683, 450);this.Controls.Add(this.button3);this.Controls.Add(this.label6);this.Controls.Add(this.groupBox1);this.Controls.Add(this.textBox1);this.Controls.Add(this.button1);this.Controls.Add(this.button2);this.MaximizeBox = false;this.Name = "Form1";this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;this.Text = "演示获取程序文件信息";this.groupBox1.ResumeLayout(false);this.ResumeLayout(false);this.PerformLayout();}

控件配置详解

Button 控件 (button1)

this.button1.Location = new System.Drawing.Point(41, 48);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(112, 23);
this.button1.TabIndex = 1;
this.button1.Text = "浏览程序文件";
this.button1.Click += new System.EventHandler(this.button1_Click);
  • Location: 设置按钮的位置为 (41, 48)
  • Name: 按钮的名称为 button1
  • Size: 按钮的大小为 112x23 像素。
  • TabIndex: 按钮的Tab顺序索引为 1
  • Text: 按钮上显示的文字为“浏览程序文件”。
  • Click Event: 绑定点击事件到 button1_Click 方法。

TextBox 控件 (textBox1)

this.textBox1.BackColor = System.Drawing.SystemColors.Control;
this.textBox1.Location = new System.Drawing.Point(276, 112);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(256, 21);
this.textBox1.TabIndex = 2;
  • BackColor: 文本框背景颜色为系统控制颜色。
  • Location: 设置文本框的位置为 (276, 112)
  • Name: 文本框的名称为 textBox1
  • ReadOnly: 文本框设置为只读模式。
  • Size: 文本框的大小为 256x21 像素。
  • TabIndex: 文本框的Tab顺序索引为 2

GroupBox 控件 (groupBox1)

this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(41, 187);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(602, 236);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "程序文件信息";
  • Controls: 将 label1 到 label5 添加到 groupBox1 中。
  • Location: 设置 groupBox1 的位置为 (41, 187)
  • NamegroupBox1 的名称为 groupBox1
  • SizegroupBox1 的大小为 602x236 像素。
  • TabIndexgroupBox1 的Tab顺序索引为 3
  • TabStop: 设置为 false 表示不作为Tab顺序的一部分。
  • TextgroupBox1 上显示的文字为“程序文件信息”。

Label 控件 (label1 至 label5)

这些标签用于显示具体的文件信息。

// 示例:label1
this.label1.Location = new System.Drawing.Point(28, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(320, 16);
this.label1.TabIndex = 0;
this.label1.Text = "公司名称:";
  • Location: 设置标签的位置。
  • Name: 标签的名称。
  • Size: 标签的大小。
  • TabIndex: 标签的Tab顺序索引。
  • Text: 标签上显示的文字。

OpenFileDialog 控件 (openFileDialog1)

this.openFileDialog1.Filter = "程序文件(*.exe)|*.exe|All files (*.*)|*.*";
  • Filter: 设置文件过滤器,仅显示 .exe 文件和所有文件。

Button 控件 (button2)

this.button2.Location = new System.Drawing.Point(277, 48);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(112, 23);
this.button2.TabIndex = 11;
this.button2.Text = "获取程序文件信息";
this.button2.Click += new System.EventHandler(this.button2_Click);
  • 同样设置了位置、名称、大小、Tab顺序和文字,并绑定了点击事件到 button2_Click 方法。

Label 控件 (label6)

this.label6.Location = new System.Drawing.Point(130, 117);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(96, 16);
this.label6.TabIndex = 12;
this.label6.Text = "程序文件名称:";
  • 同样设置了位置、名称、大小、Tab顺序和文字。

Button 控件 (button3)

this.button3.Location = new System.Drawing.Point(515, 48);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(128, 23);
this.button3.TabIndex = 13;
this.button3.Text = "获取本程序文件信息";
this.button3.Click += new System.EventHandler(this.button3_Click);
  • 同样设置了位置、名称、大小、Tab顺序和文字,并绑定了点击事件到 button3_Click 方法。

窗体配置

this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(683, 450);
this.Controls.Add(this.button3);
this.Controls.Add(this.label6);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.button2);
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "演示获取程序文件信息";
  • AutoScaleBaseSize: 设置自动缩放基准大小。
  • ClientSize: 设置客户端区域的大小。
  • Controls: 添加所有控件到窗体中。
  • MaximizeBox: 设置不允许最大化窗口。
  • Name: 窗体的名称为 Form1
  • StartPosition: 设置窗体启动时居中显示。
  • Text: 窗体标题栏显示的文字为“演示获取程序文件信息”。

事件处理方法

浏览程序文件 (button1_Click)

private void button1_Click(object sender, EventArgs e)
{if (openFileDialog1.ShowDialog() == DialogResult.OK){textBox1.Text = openFileDialog1.FileName;}
}
  • 当点击“浏览程序文件”按钮时,调用 openFileDialog1.ShowDialog() 弹出文件对话框。
  • 如果用户选择了一个文件并点击了“确定”,则将选中的文件路径赋值给 textBox1.Text

获取程序文件信息 (button2_Click)

private void button2_Click(object sender, EventArgs e)
{string myFileName = textBox1.Text;if (myFileName.Length < 1)return;string shortName = myFileName.Substring(myFileName.LastIndexOf("\\") + 1);groupBox1.Text = shortName + "程序文件信息";FileVersionInfo myInfo = FileVersionInfo.GetVersionInfo(myFileName);label1.Text = "公司名称:" + myInfo.CompanyName;label2.Text = "产品名称:" + myInfo.ProductName;label3.Text = "语言标志:" + myInfo.Language;label4.Text = "版本号:" + myInfo.FileVersion;label5.Text = "版权声明:" + myInfo.LegalCopyright;
}
  • 从 textBox1 中获取文件路径存储在 myFileName 变量中。
  • 如果文件路径为空,则直接返回。
  • 使用 Substring 和 LastIndexOf 方法提取文件名,并设置 groupBox1 的标题。
  • 使用 FileVersionInfo.GetVersionInfo 方法获取文件的版本信息。
  • 将版本信息分别赋值给 label1 到 label5 的 Text 属性以显示相关信息。

获取本程序文件信息 (button3_Click)

private void button3_Click(object sender, EventArgs e)
{groupBox1.Text = "显示本程序文件信息";label1.Text = "公司名称:" + Application.CompanyName;label2.Text = "区域信息:" + Application.CurrentCulture;label3.Text = "语言标志:" + Application.CurrentInputLanguage;label4.Text = "产品名称:" + Application.ProductName;label5.Text = "产品版本:" + Application.ProductVersion;
}
  •  直接使用 Application 类的静态属性获取当前应用程序的版本信息。
  • 将这些信息分别赋值给 label1 到 label5 的 Text 属性以显示相关信息。

项目截图:

项目完整源码:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Diagnostics;
namespace MyFile
{/// <summary>/// Form1 的摘要说明。/// </summary>public class Form1 : System.Windows.Forms.Form{private System.Windows.Forms.Button button1;private System.Windows.Forms.TextBox textBox1;private System.Windows.Forms.GroupBox groupBox1;private System.Windows.Forms.OpenFileDialog openFileDialog1;private System.Windows.Forms.Button button2;private System.Windows.Forms.Label label1;private System.Windows.Forms.Label label2;private System.Windows.Forms.Label label3;private System.Windows.Forms.Label label4;private System.Windows.Forms.Label label5;private System.Windows.Forms.Label label6;private System.Windows.Forms.Button button3;/// <summary>/// 必需的设计器变量。/// </summary>private System.ComponentModel.Container components = null;public Form1(){//// Windows 窗体设计器支持所必需的//InitializeComponent();//// TODO: 在 InitializeComponent 调用后添加任何构造函数代码//}/// <summary>/// 清理所有正在使用的资源。/// </summary>protected override void Dispose( bool disposing ){if( disposing ){if (components != null) {components.Dispose();}}base.Dispose( disposing );}#region Windows 窗体设计器生成的代码/// <summary>/// 设计器支持所需的方法 - 不要使用代码编辑器修改/// 此方法的内容。/// </summary>private void InitializeComponent(){this.button1 = new System.Windows.Forms.Button();this.textBox1 = new System.Windows.Forms.TextBox();this.groupBox1 = new System.Windows.Forms.GroupBox();this.label5 = new System.Windows.Forms.Label();this.label4 = new System.Windows.Forms.Label();this.label3 = new System.Windows.Forms.Label();this.label2 = new System.Windows.Forms.Label();this.label1 = new System.Windows.Forms.Label();this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();this.button2 = new System.Windows.Forms.Button();this.label6 = new System.Windows.Forms.Label();this.button3 = new System.Windows.Forms.Button();this.groupBox1.SuspendLayout();this.SuspendLayout();// // button1// this.button1.Location = new System.Drawing.Point(41, 48);this.button1.Name = "button1";this.button1.Size = new System.Drawing.Size(112, 23);this.button1.TabIndex = 1;this.button1.Text = "浏览程序文件";this.button1.Click += new System.EventHandler(this.button1_Click);// // textBox1// this.textBox1.BackColor = System.Drawing.SystemColors.Control;this.textBox1.Location = new System.Drawing.Point(276, 112);this.textBox1.Name = "textBox1";this.textBox1.ReadOnly = true;this.textBox1.Size = new System.Drawing.Size(256, 21);this.textBox1.TabIndex = 2;// // groupBox1// this.groupBox1.Controls.Add(this.label5);this.groupBox1.Controls.Add(this.label4);this.groupBox1.Controls.Add(this.label3);this.groupBox1.Controls.Add(this.label2);this.groupBox1.Controls.Add(this.label1);this.groupBox1.Location = new System.Drawing.Point(41, 187);this.groupBox1.Name = "groupBox1";this.groupBox1.Size = new System.Drawing.Size(602, 236);this.groupBox1.TabIndex = 3;this.groupBox1.TabStop = false;this.groupBox1.Text = "程序文件信息";// // label5// this.label5.Location = new System.Drawing.Point(28, 197);this.label5.Name = "label5";this.label5.Size = new System.Drawing.Size(320, 16);this.label5.TabIndex = 4;this.label5.Text = "版权声明:";// // label4// this.label4.Location = new System.Drawing.Point(28, 160);this.label4.Name = "label4";this.label4.Size = new System.Drawing.Size(320, 16);this.label4.TabIndex = 3;this.label4.Text = "版本号:";// // label3// this.label3.Location = new System.Drawing.Point(28, 125);this.label3.Name = "label3";this.label3.Size = new System.Drawing.Size(320, 16);this.label3.TabIndex = 2;this.label3.Text = "语言标志:";// // label2// this.label2.Location = new System.Drawing.Point(28, 81);this.label2.Name = "label2";this.label2.Size = new System.Drawing.Size(320, 16);this.label2.TabIndex = 1;this.label2.Text = "产品名称:";// // label1// this.label1.Location = new System.Drawing.Point(28, 28);this.label1.Name = "label1";this.label1.Size = new System.Drawing.Size(320, 16);this.label1.TabIndex = 0;this.label1.Text = "公司名称:";// // openFileDialog1// this.openFileDialog1.Filter = "程序文件(*.exe)|*.exe|All files (*.*)|*.*";// // button2// this.button2.Location = new System.Drawing.Point(277, 48);this.button2.Name = "button2";this.button2.Size = new System.Drawing.Size(112, 23);this.button2.TabIndex = 11;this.button2.Text = "获取程序文件信息";this.button2.Click += new System.EventHandler(this.button2_Click);// // label6// this.label6.Location = new System.Drawing.Point(130, 117);this.label6.Name = "label6";this.label6.Size = new System.Drawing.Size(96, 16);this.label6.TabIndex = 12;this.label6.Text = "程序文件名称:";// // button3// this.button3.Location = new System.Drawing.Point(515, 48);this.button3.Name = "button3";this.button3.Size = new System.Drawing.Size(128, 23);this.button3.TabIndex = 13;this.button3.Text = "获取本程序文件信息";this.button3.Click += new System.EventHandler(this.button3_Click);// // Form1// this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);this.ClientSize = new System.Drawing.Size(683, 450);this.Controls.Add(this.button3);this.Controls.Add(this.label6);this.Controls.Add(this.groupBox1);this.Controls.Add(this.textBox1);this.Controls.Add(this.button1);this.Controls.Add(this.button2);this.MaximizeBox = false;this.Name = "Form1";this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;this.Text = "演示获取程序文件信息";this.groupBox1.ResumeLayout(false);this.ResumeLayout(false);this.PerformLayout();}#endregion/// <summary>/// 应用程序的主入口点。/// </summary>[STAThread]static void Main() {Application.Run(new Form1());}private void button1_Click(object sender, System.EventArgs e){//浏览程序文件if(this.openFileDialog1.ShowDialog()==DialogResult.OK){this.textBox1.Text=this.openFileDialog1.FileName;}}private void button2_Click(object sender, System.EventArgs e){//获取程序文件信息string MyFileName=this.textBox1.Text;if(MyFileName.Length<1)return;string ShortName=MyFileName.Substring(MyFileName.LastIndexOf("\\")+1);this.groupBox1.Text=ShortName+"程序文件信息";FileVersionInfo MyInfo=FileVersionInfo.GetVersionInfo(MyFileName);this.label1.Text="公司名称:"+MyInfo.CompanyName;this.label2.Text="产品名称:"+MyInfo.ProductName;this.label3.Text="语言标志:"+MyInfo.Language;this.label4.Text="版本号:"+MyInfo.FileVersion;this.label5.Text="版权声明:"+MyInfo.LegalCopyright;			}private void button3_Click(object sender, System.EventArgs e){//获取当前程序文件信息this.groupBox1.Text="显示本程序文件信息";this.label1.Text="公司名称:"+Application.CompanyName;this.label2.Text="区域信息:"+Application.CurrentCulture;this.label3.Text="语言标志:"+Application.CurrentInputLanguage;this.label4.Text="产品名称:"+Application.ProductName;this.label5.Text="产品版本:"+Application.ProductVersion;			}}
}

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

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

相关文章

2025.5.28总结

今日工作&#xff1a;最近进入了项目的关键节点&#xff0c;要求每人每天提两单&#xff0c;今天周三&#xff0c;下班前只提了一个单。下午开了一场需求服务验收会&#xff0c;我演示了自己验收的那个需求&#xff0c;然后讲的不是很好。当初再构造数据时请教了一个人&#xf…

Transformer核心技术解析LCPO方法:精准控制推理长度的新突破

原创文章1FFN前馈网络与激活函数技术解析&#xff1a;Transformer模型中的关键模块2Transformer掩码技术全解析&#xff1a;分类、原理与应用场景3【大模型技术】Attention注意力机制详解一4Transformer模型中位置编码&#xff08;Positional Embedding&#xff09;技术全解析(…

在 WSL 中安装 JetBrains Toolbox:完整指南

JetBrains Toolbox 是一个非常实用的工具&#xff0c;它可以帮助开发者轻松管理 JetBrains 的各种开发工具&#xff0c;如 IntelliJ IDEA、PyCharm、WebStorm 等。通过它&#xff0c;你可以快速安装、更新和管理这些工具&#xff0c;极大地提高了开发效率。而在 WSL 环境中安装…

ZooKeeper 命令操作

文章目录 Zookeeper 数据模型Zookeeper 服务端常用命令Zookeeper 客户端常用命令 Zookeeper 数据模型 ZooKeeper 是一个树形目录服务,其数据模型和Unix的文件系统目录树很类似&#xff0c;拥有一个层次化结构。这里面的每一个节点都被称为&#xff1a; ZNode&#xff0c;每个节…

Turf.js:前端地理空间分析的瑞士军刀

在Web开发中,地理空间数据处理已成为许多应用的核心需求。从地图可视化到位置服务,再到复杂的数据分析,前端开发者需要强大的工具来处理这些任务。Turf.js 作为一款轻量级、模块化的地理空间分析库,凭借其丰富的功能和易用性,成为前端开发者的得力助手。本文将深入探讨 Tu…

大模型微调

使用 Ollama 微调大语言模型&#xff08;如 LLaMA、Mistral、Gemma 等&#xff09;主要是围绕 LoRA&#xff08;Low-Rank Adaptation&#xff09;或者 QLoRA 等轻量级微调技术进行的。Ollama 本身是一个部署和运行本地大语言模型的平台&#xff0c;但其微调能力有限&#xff0c…

《自动驾驶轨迹规划实战:Lattice Planner实现避障路径生成(附可运行Python代码)》—— 零基础实现基于离散优化的避障路径规划

《自动驾驶轨迹规划实战&#xff1a;Lattice Planner实现避障路径生成&#xff08;附可运行Python代码&#xff09;》 —— 零基础实现基于离散优化的避障路径规划 一、为什么Lattice Planner成为自动驾驶的核心算法&#xff1f; 在自动驾驶的路径规划领域&#xff0c;Lattice…

切换到旧提交,同时保证当前修改不丢失

在 Git 中&#xff0c;可以通过以下几种方式切换到之前的提交&#xff0c;同时保留当前的提交&#xff08;即不丢失工作进度&#xff09;&#xff1a; 1. 使用 git checkout 创建临时分离头指针&#xff08;推荐用于查看&#xff09; git checkout <commit-hash>这会让…

zookeeper 操作总结

zookeeper 中的节点类型 节点类型命令选项说明‌持久节点‌无选项&#xff08;默认&#xff09;永久存在&#xff0c;除非手动删除。‌临时节点‌-e与客户端会话绑定&#xff0c;会话结束自动删除&#xff08;‌不能有子节点‌&#xff09;。‌顺序节点‌-s节点名自动追加递增…

nova14 ultra,是如何防住80°C热水和10000KPa水压冲击的?

暴雨突袭&#xff0c;手忙脚乱护住背包&#xff0c;却担心手机被雨水浸湿&#xff1b;泳池里想记录美好时刻&#xff0c;却担心手机掉入水中 &#xff1b;厨房里充满了高温水汽&#xff0c;近距离拍摄美食瞬间&#xff0c;手机屏幕花屏&#xff0c;让人失去了对美食的兴趣…… …

flutter加载dll 报错问题

解决flutter加载dll 报错问题 LoadLibrary 报错 126 or 193 明确一点&#xff1a;flutter构建exe 时默认是MSVC的。 1. 先检查dll 的位数是否满足 file ***.dll output: PE32 executable (DLL) (console) x86-64, for MS Windows, 19 sections 这种是64位的机器。 满足的话可…

Mac 版不能连接华为 GaussDB 吗?我看 Windows 版可以连接?

&#x1f9d1;‍&#x1f4bb; GaussDB 用户 Mac 版不能连接华为 GaussDB 吗&#xff1f;我看Windows 版可以连接。 &#x1f9d1;‍&#x1f527; 官方技术中心 由于 GaussDB 数据库本身未支持 macOS 系统&#xff0c;所以在 macOS 上的 Navicat 中也未支持该数据库。 &…

【MySQL成神之路】MySQL索引相关介绍

1 相关理论介绍 一、索引基础概念 二、索引类型 1. 按数据结构分类 2. 按功能分类 三、索引数据结构原理 B树索引特点&#xff1a; 哈希索引特点&#xff1a; 四、索引使用原则 1. 创建索引原则 2. 避免索引失效情况 五、索引优化策略 六、索引维护与管理 七、特殊…

五、web安全--XSS漏洞(1)--XSS漏洞利用全过程

本文章仅供学习交流&#xff0c;如作他用所承受的法律责任一概与作者无关1、XSS漏洞利用全过程 1.1 寻找注入点&#xff1a;攻击者首先需要找到目标网站中可能存在XSS漏洞的注入点。这些注入点通常出现在用户输入能够直接输出到页面&#xff0c;且没有经过适当过滤或编码的地方…

使用 Shell 脚本实现 Spring Boot 项目自动化部署到 Docker(Ubuntu 服务器)

使用 Shell 脚本实现 Spring Boot 项目自动化部署到 Docker&#xff08;Ubuntu 服务器&#xff09; 在日常项目开发中&#xff0c;我们经常会将 Spring Boot 项目打包并部署到服务器上的 Docker 环境中。为了提升效率、减少重复操作&#xff0c;我们可以通过 Shell 脚本实现自动…

高考加油(Python+HTML)

前言 询问DeepSeek根据自己所学到的知识来生成多个可执行的代码&#xff0c;为高考学子加油。最开始生成的都会有点小问题&#xff0c;还是需要自己调试一遍&#xff0c;下面就是完整的代码&#xff0c;当然了最后几天也不会有多少人看&#xff0c;都在专心的备考。 Python励…

HTTP协议接口三种测试方法之-JMeter(保姆教程)

在当今 API 驱动的开发世界中&#xff0c;高效、可靠的 HTTP 接口测试是保障应用质量的关键。作为开源性能测试工具中的王者&#xff0c;Apache JMeter 不仅擅长压力测试&#xff0c;更是进行功能性和回归测试的利器。本文将手把手教你如何用 JMeter 构建强大的 HTTP 测试计划&…

聊聊JVM怎么调优?(实战总结)

JVM 核心配置与调优指南 一、堆内存与年轻代配置&#xff08;影响最大&#xff09; 堆内存大小&#xff1a; 在资源允许的前提下&#xff0c;堆内存应尽可能设置得更大。关键点&#xff1a; 必须将堆内存的最大值 (-Xmx) 和最小值 (-Xms) 设置为相同值。动态扩容会触发 Full G…

开疆智能Profinet转Profibus网关连接费斯托阀岛总线模块配置案例

本案例是通过开疆智能Profibus转Profinet网关将费托斯阀岛接入到西门子1200PLC的配置案例。 首先我们先了解一下Profibus报文以及他的通讯原理。 除了起始符 SD 和结束符 ED 这些固定数值之外&#xff0c;还有功能码&#xff08;Function Code, FC&#xff09;和服务访问点&…

ARM内核一览

经常看介绍某某牛批芯片用的又是ARM什么核&#xff0c;看的云里雾里&#xff0c;所以简单整理整理。&#xff08;内容来自官网和GPT&#xff09; 1 ARM 内核总体分类 系列特点应用场景Cortex-M超低功耗、低成本、实时性嵌入式系统、微控制器、IoTCortex-R高可靠性、硬实时汽车…