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)
  • Name:?groupBox1?的名稱為?groupBox1
  • Size:?groupBox1?的大小為?602x236?像素。
  • TabIndex:?groupBox1?的Tab順序索引為?3
  • TabStop: 設置為?false?表示不作為Tab順序的一部分。
  • Text:?groupBox1?上顯示的文字為“程序文件信息”。

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
繁體地址,請注明出處:http://hk.pswp.cn/diannao/84790.shtml
英文地址,請注明出處:http://en.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高可靠性、硬實時汽車…