C# 学习笔记

news2024/11/28 4:43:29

不再是学生了,成了社畜了,公司主要技术栈是C#
大一时候学C#学的很迷糊,总要重新学一下
入职已经20天了,也开始上手简单增删改查了
记录了一些C#相关的东西,只是还没有系统整理

WinForm

控件命名规范
image-20230705080620883

ADO.NET

连接数据库 Connection 对象

string constr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.20.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=abac)));User ID=abac;Password=abac";
OracleConnection con = new OracleConnection(constr);//连接到数据库
this.con.Open();

ConnectionState 枚举

image-20230705101138391

关闭连接

Dispose 和 Close

Close用于关闭一个连接,而Dispose方法不仅关闭一个连接,而且还清理连接所占用的资源。当调用Close方法关闭连接后,还可以再调用Open方法打开连接,而如果使用Dispose方法关闭连接,就不能再调用Open方法打开连接,必须重新初始化连接再打开。

执行SQL语句 Command对象

ExecuteNonQuery()方法,返回受影响的行数

OracleCommand command = new OracleCommand("insert into " +
                                          "ABXRTEST02(SYSID,STRING1,NUMBER1,DT1) values ('" +
                                          sysid_textbox.Text + "','" + string1_textbox.Text +
                                          "','" + number1_textbox.Text + "',to_date('" +
                                          dt1_date.Text + "','yyyy-mm-dd'))", this.con);
command.ExecuteNonQuery();

ExecuteReader()方法,返回一个SqlDataReader对象

ExecuteScalar()方法,返回结果集中的第一行第一列(若结果集为空返回空引用)

读取数据 DataReader对象

HasRows()方法,返回是否有一行或多行数据

Read()方法,返回是否存在多个行

数据适配器 DataAdapter对象

查询数据并填充至DataTable

string strQuery = @"select SYSID,STRING1,NUMBER1,DT1 from ABXRTEST02 where SYSID='" + SYSID +
    "' and STRING1='" + STRING1 + "' and NUMBER1='" + NUMBER1 + "'";
OracleDataAdapter adapter = new OracleDataAdapter(strQuery, this.con);
DataTable dtResult = new DataTable();
adapter.Fill(dtResult);
adapter.Dispose();

DataSet对象

相当于存放于内存的小型数据库,可以包含数据表、数据列、数据行、视图、约束关系等信息

合并DataSet内容

Merge(DataSet ds, bool Pc, MissingSchemaAction msa)方法

ds:被合并的数据和架构

pc:要保留当前DataSet中的更改则为true,否则为false

msa:MissingSchemaAction枚举值之一

image-20230706140155318

复制DataSet内容

Copy()方法,返回一个DataSet的副本

FreeSQL

数据库连接单例

using System;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace Demo_7_4 {
    public class DB {
        static Lazy<IFreeSql> oracleLazy = new Lazy<IFreeSql>(() => new FreeSql.FreeSqlBuilder()
            .UseConnectionString(FreeSql.DataType.Oracle, "user id=abac;password=abac;data source=//10.168.8.1:1521/oradbsgl;Pooling=true;Max Pool Size=2")
            .UseAutoSyncStructure(true)
            .UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
            .UseNoneCommandParameter(true)
            .UseMonitorCommand(cmd => Trace.WriteLine(cmd.CommandText))
            .Build());
        public static IFreeSql oracle => oracleLazy.Value;
    }
}

fsql.Insert(new ABXRTEST02 {
    STRING1 = txtString1.Text,
    NUMBER1 = int.Parse(txtNumber1.Text),
    DT1 = dtpickerDt1.Value
}).ExecuteAffrows();

fsql.Delete<ABXRTEST02>()
    .Where(b => b.SYSID == this.curIdx)
    .ExecuteAffrows();

fsql.Update<ABXRTEST02>()
    .Set(b => b.STRING1, txtString1.Text)
    .Set(b => b.NUMBER1, int.Parse(txtNumber1.Text))
    .Set(b => b.DT1, dtpickerDt1.Value)
    .Where(b => b.SYSID == this.SYSID)
    .ExecuteAffrows();

fsql.Select<ABXRTEST02>()
    .Where(a => a.SYSID == this.SYSID)
    .ToList();
fsql.Select<ABXRTEST02>().ToList();

实操

C#连接Oracle

数据表结构

首先是数据表结构如下

image-20230704163005075

WinForm界面

界面如下

image-20230704163203853

界面注意点:

DT1 对应的 DateTimePickerFormat 属性改为 Short

STRING1 的数据列为nvarchar2(20),故其对应TextBox应设置最大长度(MaxLength)为20

SYSIDNUMBER1对应的TextBox应只能输入数字,故为其KeyPress事件添加方法如下

private void number1_textbox_KeyPress(object sender, KeyPressEventArgs e) {
    if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8) { e.Handled = true; }
}

主要代码

数据库连接代码

OracleConnection con;
string constr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.168.8.109)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=abac)));User ID=abac;Password=abac";

private void Form1_Load(object sender, EventArgs e) {
    this.con = new OracleConnection(constr);//连接到数据库
    this.con.Open();
}

获取数据列表

private void getList() {
    string cmdText = @"select SYSID,STRING1,NUMBER1,DT1 from ABXRTEST02 ";
    OracleDataAdapter adapter = new OracleDataAdapter(cmdText, constr);
    DataSet dataSet = new DataSet();
    adapter.Fill(dataSet, "QueryResult");
    adapter.Dispose();
    DataTable dt = dataSet.Tables[0];
    this.dataGridView1.Columns["SYSID"].DataPropertyName = "SYSID";
    this.dataGridView1.Columns["STRING1"].DataPropertyName = "STRING1";
    this.dataGridView1.Columns["NUMBER1"].DataPropertyName = "NUMBER1";
    this.dataGridView1.Columns["DT1"].DataPropertyName = "DT1";
    this.dataGridView1.DataSource = dt;
}

添加数据时要注意,SYSID不能重复

try {
    OracleCommand command = new OracleCommand("insert into " +
                                              "ABXRTEST02(SYSID,STRING1,NUMBER1,DT1) values ('" +
                                              sysid_textbox.Text + "','" + string1_textbox.Text +
                                              "','" + number1_textbox.Text + "',to_date('" +
                                              dt1_date.Text + "','yyyy-mm-dd'))", this.con);
    command.ExecuteNonQuery();
    command.Dispose();
    MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
} catch (Exception ex) {
    MessageBox.Show("添加失败,SYSID重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    return;
}

全部代码

Form1.cs

using System.Data;
using System.Drawing;
using Oracle.ManagedDataAccess.Client;//oracle数据提供程序

namespace Demo_7_4 {
    public partial class Form1 : Form {
        OracleConnection con;
        string constr = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.168.6.29)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=abac)));User ID=abac;Password=abac";
        string flag = "";
        public Form1() {
            InitializeComponent();
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e) {
            this.sysid_textbox.Text = "";
            this.string1_textbox.Text = "";
            this.number1_textbox.Text = "";
            this.dt1_date.Text = "";
            this.sysid_textbox.Enabled = true;
            this.string1_textbox.Enabled = true;
            this.number1_textbox.Enabled = true;
            this.dt1_date.Enabled = true;
            this.button3.Enabled = false;
            this.button2.Enabled = false;
            this.add_button.Enabled = false;
            this.button1.Enabled = true;
            this.flag = "add";
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e) {
            this.sysid_textbox.Enabled = false;
            this.string1_textbox.Enabled = true;
            this.number1_textbox.Enabled = true;
            this.dt1_date.Enabled = true;
            this.button1.Enabled = true;
            this.button3.Enabled = false;
            this.button2.Enabled = false;
            this.add_button.Enabled = true;
            this.flag = "edit";
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e) {
            if ((MessageBox.Show("是否真的要删除用户" + this.sysid_textbox.Text + "吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)).Equals(DialogResult.Yes)) {
                String strQuery = "delete from ABXRTEST02 where SYSID='" + sysid_textbox.Text + "'";
                OracleCommand command = new OracleCommand(strQuery, this.con);
                int num = command.ExecuteNonQuery();
                command.Dispose();
                MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                getList();
                this.sysid_textbox.Text = "";
                this.string1_textbox.Text = "";
                this.number1_textbox.Text = "";
                this.dt1_date.Text = "";
                this.sysid_textbox.Enabled = false;
                this.string1_textbox.Enabled = false;
                this.number1_textbox.Enabled = false;
                this.button3.Enabled = false;
                this.button2.Enabled = false;
                this.button1.Enabled = false;
                this.dt1_date.Enabled = false;
            }
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) {
            DataTable dt = (DataTable)this.dataGridView1.DataSource;
            if (e.RowIndex > -1) {
                string SYSID = dt.Rows[e.RowIndex]["SYSID"].ToString();
                string STRING1 = dt.Rows[e.RowIndex]["STRING1"].ToString();
                string NUMBER1 = dt.Rows[e.RowIndex]["NUMBER1"].ToString();
                string DT1 = dt.Rows[e.RowIndex]["DT1"].ToString();
                string strQuery = @"select SYSID,STRING1,NUMBER1,DT1 from ABXRTEST02
where SYSID='" + SYSID + "' and STRING1='" + STRING1 + "' and NUMBER1='" + NUMBER1 +
"'";
                OracleDataAdapter adapter = new OracleDataAdapter(strQuery, this.constr);
                DataSet dataSet = new DataSet();
                adapter.Fill(dataSet, "QueryResult");
                adapter.Dispose();
                DataTable dtResult = dataSet.Tables[0];
                this.sysid_textbox.Text = dtResult.Rows[0]["SYSID"].ToString();
                this.string1_textbox.Text = dtResult.Rows[0]["STRING1"].ToString();
                this.number1_textbox.Text = dtResult.Rows[0]["NUMBER1"].ToString();
                this.dt1_date.Text = dtResult.Rows[0]["DT1"].ToString();
                this.button2.Enabled = true;
                this.button1.Enabled = false;
                this.add_button.Enabled = true;
                this.button3.Enabled = true;
            }
        }

        private void Form1_Load(object sender, EventArgs e) {
            this.sysid_textbox.Enabled = false;
            this.string1_textbox.Enabled = false;
            this.number1_textbox.Enabled = false;
            this.button3.Enabled = false;
            this.button2.Enabled = false;
            this.button1.Enabled = false;
            this.dt1_date.Enabled = false;
            this.con = new OracleConnection(constr);//连接到数据库
            this.con.Open();
            getList();
        }
        private void getList() {
            string cmdText = @"select SYSID,STRING1,NUMBER1,DT1 from ABXRTEST02 ";
            OracleDataAdapter adapter = new OracleDataAdapter(cmdText, constr);
            DataSet dataSet = new DataSet();
            adapter.Fill(dataSet, "QueryResult");
            adapter.Dispose();
            DataTable dt = dataSet.Tables[0];
            this.dataGridView1.Columns["SYSID"].DataPropertyName = "SYSID";
            this.dataGridView1.Columns["STRING1"].DataPropertyName = "STRING1";
            this.dataGridView1.Columns["NUMBER1"].DataPropertyName = "NUMBER1";
            this.dataGridView1.Columns["DT1"].DataPropertyName = "DT1";
            this.dataGridView1.DataSource = dt;
        }
        private void button1_Click_1(object sender, EventArgs e) {
            if (this.string1_textbox.Text == "") {
                MessageBox.Show("STRING1不允许为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.string1_textbox.Focus();
                return;
            } else if (this.number1_textbox.Text == "") {
                MessageBox.Show("NUMBER1不允许为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.number1_textbox.Focus();
                return;
            } else if (this.dt1_date.Text == "") {
                MessageBox.Show("DT1不允许为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.dt1_date.Focus();
                return;
            }
            if (this.flag == "add") {
                try {
                    OracleCommand command = new OracleCommand("insert into " +
                    "ABXRTEST02(SYSID,STRING1,NUMBER1,DT1) values ('" + sysid_textbox.Text +
                    "','" + string1_textbox.Text + "','"
                    + number1_textbox.Text + "',to_date('"
                    + dt1_date.Text + "','yyyy-mm-dd'))", this.con);
                    command.ExecuteNonQuery();
                    command.Dispose();
                    MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                } catch (Exception ex) {
                    MessageBox.Show("添加失败,SYSID重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            } else if (this.flag == "edit") {
                OracleCommand command = new OracleCommand("update ABXRTEST02 set " +
                "STRING1='" + string1_textbox.Text + "', " +
                "NUMBER1='" + number1_textbox.Text + "', " +
                "DT1=to_date('" + dt1_date.Text + "','yyyy-mm-dd') where SYSID='" + sysid_textbox.Text + "'", this.con);
                command.ExecuteNonQuery();
                command.Dispose();
                MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            getList();
            this.button1.Enabled = false;
            this.add_button.Enabled = true;

            this.sysid_textbox.Enabled = false;
            this.string1_textbox.Enabled = false;
            this.number1_textbox.Enabled = false;
            this.dt1_date.Enabled = false;

            this.sysid_textbox.Text = "";
            this.string1_textbox.Text = "";
            this.number1_textbox.Text = "";
            this.dt1_date.Text = "";
        }

        private void number1_textbox_KeyPress(object sender, KeyPressEventArgs e) {
            if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8) { e.Handled = true; }
        }

        ~Form1() {
            this.con.Close();
        }
    }
}

Form1.Designer.cs

namespace Demo_7_4 {
    partial class Form1 {
        /// <summary>
        ///  Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        ///  Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing) {
            if (disposing && (components != null)) {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        ///  Required method for Designer support - do not modify
        ///  the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {
            components = new System.ComponentModel.Container();
            bindingSource1 = new BindingSource(components);
            label1 = new Label();
            label2 = new Label();
            label3 = new Label();
            label4 = new Label();
            dataGridView1 = new DataGridView();
            SYSID = new DataGridViewTextBoxColumn();
            STRING1 = new DataGridViewTextBoxColumn();
            NUMBER1 = new DataGridViewTextBoxColumn();
            DT1 = new DataGridViewTextBoxColumn();
            add_button = new Button();
            button2 = new Button();
            sysid_textbox = new TextBox();
            string1_textbox = new TextBox();
            number1_textbox = new TextBox();
            dt1_date = new DateTimePicker();
            button3 = new Button();
            button1 = new Button();
            ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit();
            ((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
            SuspendLayout();
            // 
            // label1
            // 
            label1.AutoSize = true;
            label1.Location = new Point(25, 42);
            label1.Name = "label1";
            label1.Size = new Size(51, 20);
            label1.TabIndex = 0;
            label1.Text = "SYSID";
            // 
            // label2
            // 
            label2.AutoSize = true;
            label2.Location = new Point(698, 42);
            label2.Name = "label2";
            label2.Size = new Size(38, 20);
            label2.TabIndex = 1;
            label2.Text = "DT1";
            // 
            // label3
            // 
            label3.AutoSize = true;
            label3.Location = new Point(465, 42);
            label3.Name = "label3";
            label3.Size = new Size(83, 20);
            label3.TabIndex = 2;
            label3.Text = "NUMBER1";
            // 
            // label4
            // 
            label4.AutoSize = true;
            label4.Location = new Point(230, 42);
            label4.Name = "label4";
            label4.Size = new Size(73, 20);
            label4.TabIndex = 3;
            label4.Text = "STRING1";
            // 
            // dataGridView1
            // 
            dataGridView1.AccessibleRole = AccessibleRole.MenuPopup;
            dataGridView1.AllowUserToAddRows = false;
            dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            dataGridView1.Columns.AddRange(new DataGridViewColumn[] { SYSID, STRING1, NUMBER1, DT1 });
            dataGridView1.Location = new Point(25, 215);
            dataGridView1.Name = "dataGridView1";
            dataGridView1.ReadOnly = true;
            dataGridView1.RowHeadersWidth = 51;
            dataGridView1.RowTemplate.Height = 29;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.Size = new Size(910, 342);
            dataGridView1.TabIndex = 4;
            dataGridView1.CellContentClick += dataGridView1_CellContentClick;
            // 
            // SYSID
            // 
            SYSID.HeaderText = "SYSID";
            SYSID.MinimumWidth = 6;
            SYSID.Name = "SYSID";
            SYSID.ReadOnly = true;
            SYSID.Width = 125;
            // 
            // STRING1
            // 
            STRING1.HeaderText = "STRING1";
            STRING1.MinimumWidth = 6;
            STRING1.Name = "STRING1";
            STRING1.ReadOnly = true;
            STRING1.Width = 125;
            // 
            // NUMBER1
            // 
            NUMBER1.HeaderText = "NUMBER1";
            NUMBER1.MinimumWidth = 6;
            NUMBER1.Name = "NUMBER1";
            NUMBER1.ReadOnly = true;
            NUMBER1.Width = 125;
            // 
            // DT1
            // 
            DT1.HeaderText = "DT1";
            DT1.MinimumWidth = 6;
            DT1.Name = "DT1";
            DT1.ReadOnly = true;
            DT1.Width = 200;
            // 
            // add_button
            // 
            add_button.Location = new Point(178, 134);
            add_button.Name = "add_button";
            add_button.Size = new Size(125, 49);
            add_button.TabIndex = 5;
            add_button.Text = "添加";
            add_button.UseVisualStyleBackColor = true;
            add_button.Click += button1_Click;
            // 
            // button2
            // 
            button2.Location = new Point(369, 134);
            button2.Name = "button2";
            button2.Size = new Size(135, 49);
            button2.TabIndex = 6;
            button2.Text = "修改";
            button2.UseVisualStyleBackColor = true;
            button2.Click += button2_Click;
            // 
            // sysid_textbox
            // 
            sysid_textbox.Location = new Point(99, 39);
            sysid_textbox.Name = "sysid_textbox";
            sysid_textbox.Size = new Size(125, 27);
            sysid_textbox.TabIndex = 7;
            sysid_textbox.KeyPress += number1_textbox_KeyPress;
            // 
            // string1_textbox
            // 
            string1_textbox.Location = new Point(309, 39);
            string1_textbox.MaxLength = 20;
            string1_textbox.Name = "string1_textbox";
            string1_textbox.Size = new Size(125, 27);
            string1_textbox.TabIndex = 8;
            // 
            // number1_textbox
            // 
            number1_textbox.Location = new Point(554, 39);
            number1_textbox.Name = "number1_textbox";
            number1_textbox.Size = new Size(125, 27);
            number1_textbox.TabIndex = 9;
            number1_textbox.KeyPress += number1_textbox_KeyPress;
            // 
            // dt1_date
            // 
            dt1_date.Format = DateTimePickerFormat.Short;
            dt1_date.Location = new Point(763, 37);
            dt1_date.Name = "dt1_date";
            dt1_date.Size = new Size(172, 27);
            dt1_date.TabIndex = 11;
            // 
            // button3
            // 
            button3.Location = new Point(568, 134);
            button3.Name = "button3";
            button3.Size = new Size(135, 49);
            button3.TabIndex = 12;
            button3.Text = "删除";
            button3.UseVisualStyleBackColor = true;
            button3.Click += button3_Click;
            // 
            // button1
            // 
            button1.Location = new Point(763, 134);
            button1.Name = "button1";
            button1.Size = new Size(135, 49);
            button1.TabIndex = 13;
            button1.Text = "确定";
            button1.UseVisualStyleBackColor = true;
            button1.Click += button1_Click_1;
            // 
            // Form1
            // 
            AutoScaleDimensions = new SizeF(9F, 20F);
            AutoScaleMode = AutoScaleMode.Font;
            ClientSize = new Size(965, 569);
            Controls.Add(button1);
            Controls.Add(button3);
            Controls.Add(dt1_date);
            Controls.Add(number1_textbox);
            Controls.Add(string1_textbox);
            Controls.Add(sysid_textbox);
            Controls.Add(button2);
            Controls.Add(add_button);
            Controls.Add(dataGridView1);
            Controls.Add(label4);
            Controls.Add(label3);
            Controls.Add(label2);
            Controls.Add(label1);
            Name = "Form1";
            Text = "Form1";
            Load += Form1_Load;
            ((System.ComponentModel.ISupportInitialize)bindingSource1).EndInit();
            ((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
            ResumeLayout(false);
            PerformLayout();
        }

        #endregion

        private BindingSource bindingSource1;
        private Label label1;
        private Label label2;
        private Label label3;
        private Label label4;
        private DataGridView dataGridView1;
        private Button add_button;
        private Button button2;
        private TextBox sysid_textbox;
        private TextBox string1_textbox;
        private TextBox number1_textbox;
        private DateTimePicker dt1_date;
        private Button button3;
        private DataGridViewTextBoxColumn SYSID;
        private DataGridViewTextBoxColumn STRING1;
        private DataGridViewTextBoxColumn NUMBER1;
        private DataGridViewTextBoxColumn DT1;
        private Button button1;
    }
}

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

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

相关文章

爬虫-微博个人主页的获取

我们在利用爬虫爬取微博个人主页的时候&#xff0c;我们需要获取到个人页面的cookie才能进入到微博的个人主页&#xff0c;否则的话将会是一直跳转到登录页面而导致不能进入个人主页。 import urllib.request url #自己微博个人主页的源代码 headers {User-Agent:Mozilla/5.…

办公软件ppt的制作

毕业找工作太难了&#xff0c;赶紧多学点什么东西吧&#xff0c;今天开始办公软件ppt的制作学习。 本文以WPS作为默认办公软件&#xff0c;问为什么不是PowerPoint&#xff0c;问就是没钱买不起&#xff0c;绝对不是不会破解的原因。 一.认识软件 在快捷工具栏中顾名思义就是一…

什么是框架?为什么要学框架?

一、什么是框架 框架是整个或部分应用的可重用设计&#xff0c;是可定制化的应用骨架。它可以帮开发人员简化开发过程&#xff0c;提高开发效率。 项目里有一部分代码&#xff1a;和业务无关&#xff0c;而又不得不写的代码>框架 项目里剩下的部分代码&#xff1a;实现业务…

机器学习:Bert and its family

Bert 先用无监督的语料去训练通用模型&#xff0c;然后再针对小任务进行专项训练学习。 ELMoBertERNIEGroverBert&PALS Outline Pre-train Model 首先介绍预训练模型&#xff0c;预训练模型的作用是将一些token表示成一个vector 比如&#xff1a; Word2vecGlove 但是对于…

Qt Creator创建控制台项目显示中文乱码

今天在使用Qt Creator创建c项目的时候显示中文乱码&#xff0c;这里分享一下解决办法&#xff0c;主要是由于我们的电脑大部分是GBK编码格式的是&#xff0c;然后Qt默认创建的一般是utf-8编码类型的。编码类型不一致就会导致中文乱码的现象。 从控制台的属性可以看到我们的程序…

Observability:Synthetic monitoring - 动手实践

在我之前的如下文章里&#xff1a; Observability&#xff1a;Synthetic monitoring - 合成监测入门&#xff08;一&#xff09;&#xff08;二&#xff09; Observability&#xff1a;Synthetic monitoring - 创建浏览器监测&#xff0c;配置单独的浏览器监测器及项目 我详…

基于RASC的keil电子时钟制作(瑞萨RA)(3)----使用J-Link烧写程序到瑞萨芯片

基于RASC的keil电子时钟制作3_使用J-Link烧写程序到瑞萨芯片 概述硬件准备视频教程软件准备hex文件准备J-Link与瑞萨开发板进行SWD方式接线烧录 概述 这一节主要讲解如何使用J-Link对瑞萨RA芯片进行烧录。 硬件准备 首先需要准备一个开发板&#xff0c;这里我准备的是芯片型…

【Node.js 安装】Node.js安装与使用教程

Node.js 安装 Node.js 是什么那什么是运行时 如何安装 Node.jsNode 使用教程 Node.js 是什么 先说结论&#xff0c;Node.js 它是一套 JavaScript 运行环境&#xff0c;用来支持 JavaScript 代码的执行 JavaScript 诞生于 1995 年&#xff0c;几乎是和互联网同时出现&#xf…

leetcode-206.反转链表

leetcode-206.反转链表 文章目录 leetcode-206.反转链表一.题目描述二.代码提交三.易错点 一.题目描述 二.代码提交 代码 class Solution {public:ListNode *reverseList(ListNode *head) {ListNode *temp; // 保存cur的下一个节点ListNode *cur head;ListNode *pre nullptr…

scikit-learn集成学习代码批注及相关练习

一、代码批注 代码来自&#xff1a;https://scikit-learn.org/stable/auto_examples/ensemble/plot_adaboost_twoclass.html#sphx-glr-auto-examples-ensemble-plot-adaboost-twoclass-py import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import …

【stable diffusion】保姆级入门课程02-Stable diffusion(SD)图生图-基础图生图用法

目录 学前视频 0.本章素材 1.图生图是什么 2.图生图能做什么 3.如何使用图生图 4.功能区域 4.1.提示词区域 4.2.图片提示词反推区域 1.CLIP反推 2.DeepBooru 反推 4.3.图片上传区域 4.4.结果图区域 4.5.缩放模式 4.6.重绘幅度 7.结语 8.课后训练 学前视频 …

【Ranking】50 Matplotlib Visualizations, Python实现,源码可复现

详情请参考博客: Top 50 matplotlib Visualizations 因编译更新问题&#xff0c;本文将稍作更改&#xff0c;以便能够顺利运行。 1 Ordered Bar Chart 有序条形图有效地传达项目的排名顺序。但是&#xff0c;将图表上方的指标值相加&#xff0c;用户将从图表本身获得准确的信息…

制造业想要数字化转型应该从哪方面入手?

制造业可以通过关注以下几个关键领域来开启数字化转型之旅&#xff1a; 数据收集和分析&#xff1a;实施系统收集和分析来自各种来源&#xff08;例如机器、传感器和生产过程&#xff09;的数据至关重要。这些数据可以提供有关运营效率、质量控制和预测性维护的见解。 物联网&…

Flask Bootstrap 导航条

(43条消息) Flask 导航栏&#xff0c;模版渲染多页面_U盘失踪了的博客-CSDN博客 (43条消息) 学习记录&#xff1a;Bootstrap 导航条示例_bootstrap导航栏案例_U盘失踪了的博客-CSDN博客 1&#xff0c;引用Bootstrap css样式&#xff0c;导航栏页面跳转 2&#xff0c;页面两列…

【冒泡排序】模仿qsort的功能实现一个通用的冒泡排序

文章目录 前言曾经学的冒泡排序存在着一些局限性首先第一步&#xff1a;写一个main()函数&#xff0c;分装一个test1函数test1函数 用来描写类型的性状 在test1创建了bubble_int 函数&#xff0c;下一步就是实现它&#xff0c;分两步走步骤一&#xff1a;写函数参数步骤二&…

Matlab论文插图绘制模板第107期—标签散点图

在之前的文章中&#xff0c;分享了Matlab散点图绘制模板&#xff1a; 进一步&#xff0c;再来分享一种特殊的散点图&#xff1a;标签散点图。 先来看一下成品效果&#xff1a; 特别提示&#xff1a;本期内容『数据代码』已上传资源群中&#xff0c;加群的朋友请自行下载。有需…

内网穿透远程查看内网监控摄像头

内网穿透远程查看内网监控摄像头 在现代社会中&#xff0c;大家总是奔波于家和公司之间。大部分时间用于工作中&#xff0c;也就很难及时知晓家中的动态情况&#xff0c;对于家中有老人、小孩或宠物的&#xff08;甚至对居住环境安全不放心的&#xff09;&#xff0c;这已然是…

ubuntu下tmux安装

目录 0. 前言1. Tmux介绍2. 安装3. 验证安装 0. 前言 本节安装tmux终端复用工具&#xff0c;在Ubuntu中运行一些服务或脚本的时候往往不能退出终端&#xff0c;需要一直挂着。在有图形界面的linux中你还可以新开一个终端去做别的事&#xff0c;但是在无界面linux中&#xff0c…

re学习(22)伪造CTF(谜之操作)

思维导图&#xff1a;找flag关键之处 1.字符串 &#xff08;flag&#xff0c; sorry&#xff09; 2.导入函数&#xff1a;&#xff08;Import _scanf &#xff09; 其他函数&#xff08;敏感函数&#xff09; createfileA:将flag放在一个文件中 Createprocess&am…

基于HCL的​​​​​​​网络规划与部署综合实训报告

0、前言 本次实验是对之前有关网络规划与综合部署的综合实验&#xff0c;适合入门的同学们进行学习&#xff0c;该实验选择了使用华三模拟器进行&#xff0c;希望能够帮助大家了解相关的指令。 一、实训目的及意义 ① 掌握网络规划和设计的基本流程 从需求分析开始做起&#x…