衡水如何做企业网站/中国十大网络销售公司
JavaFX 加载 fxml 文件主要有两种方式,第一种方式通过 FXMLLoader 类直接加载 fxml 文件,简单直接,但是有些控件目前还不知道该如何获取,所以只能显示,目前无法处理。第二种方式较为复杂,但是可以使用与 fxml 文件对应的 ***Controller 类可以操作 fxml 文件中的所有控件。现将两种方式介绍如下:
方式一:
- 创建 fxml 的 UI 文件
- 将 fxml 文件放置到对应位置
- FXMLLoader 加载文件显示
fxml 文件:
<?xml version="1.0" encoding="UTF-8"?><?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?><VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"><children><Button fx:id="ownedNone" alignment="CENTER" mnemonicParsing="false" text="Owned None" /><Button fx:id="nonownedNone" mnemonicParsing="false" text="Non-owned None" /><Button fx:id="ownedWindowModal" mnemonicParsing="false" text="Owned Window Modal" /><Button mnemonicParsing="false" text="Button" /><Button mnemonicParsing="false" text="Button" /></children>
</VBox>
UI 显示:
java加载 fxml 文件:
package ch04;import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Cursor;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.Window;/*** @author qiaowei* @version 1.0* @package ch04* @date 2020/5/24* @description*/
public class LoadFXMLTest extends Application {public static void main(String[] args) {launch(args);}@Overridepublic void start(Stage primaryStage) {try {useFXMLLoader(primaryStage);} catch (Exception ex) {ex.printStackTrace();}}/**@class LoadFXMLTest@date 2020/5/24@author qiaowei@version 1.0@brief 使用FXMLLoader加载fxml文件并生成相应的java类@param primaryStage Application创建的Stage实例*/public void useFXMLLoader(Stage primaryStage) throws Exception {Parent root =FXMLLoader.load(getClass().getResource("/sources/StageModalityWindow.fxml"));// 根据控件在窗体控件的添加顺序编号获取// Button ownedNone = (Button) ((VBox) root).getChildren().get(0);Button ownedNone = (Button) root.lookup("#ownedNone");ownedNone.setOnAction(e -> resetWindowTitle(primaryStage, "hello ownedNone"));Button ownedWindowModal = (Button) root.lookup("#ownedWindowModal");ownedWindowModal.setOnAction(e -> resetWindowTitle(primaryStage, "ownedWindowModal"));int width = ((int) ((VBox) root).getPrefWidth());int height = ((int) ((VBox) root).getPrefHeight());
//Scene scene = new Scene(root, width, height);
// Scene scene = new Scene(root);
// Button ownedNoneButton = ((VBox) root).getChildren().get(1);primaryStage.setTitle("StageModality");primaryStage.setScene(scene);primaryStage.show();}/**@class StageModalityApp@date 2020/3/6@author qiaowei@version 1.0@description 根据窗口拥有者和模式设置窗口状态@param owner 窗口的父控件@param modality 窗口的模式*/private void showDialog(Window owner, Modality modality) {// Create a new stage with specified owner and modalityStage stage = new Stage();stage.initOwner(owner);stage.initModality(modality);Label modalityLabel = new Label(modality.toString());Button closeButton = new Button("Close");closeButton.setOnAction(e -> stage.close());VBox root = new VBox();root.getChildren().addAll(modalityLabel, closeButton);Scene scene = new Scene(root, 200, 100);// 设置鼠标在scene的显示模式scene.setCursor(Cursor.HAND);stage.setScene(scene);stage.setTitle("A Dialog Box");stage.show();}private void resetWindowTitle(Stage stage, String title) {stage.setTitle(title);}
}
根据 fxml 中控件的 “fx:id” 属性获取控件,并添加触发事件。通过 button 修改窗体的 title
注意两点:
- fxml 的存放路径,不同位置加载 String 不同。
- fxml 加载后返回的是 root 实例,需要放置到 sence 实例中再显示。
- 在通过 fxml 中控件的 id 返回控件时,id 前要加 #字符。
第二种方式
- 创建 fxml 文件,在 fxml 文件的顶层控件设置 “fx:controller”,属性值 =“完整的包路径.***Controller”
在完整的包路径下创建 ***Controller 类,在 fxml 文件中定义的控件和方法前都加 “@FXML”,注意两个文件中的对应控件、方法名称必须保持一致。
注意:***Controller 类在这里只继承 Objec,这样其中的控件都自动绑定到 fxml 中的控件,不会出现控件为 null 的情况。退出程序按钮。不添加 "@FXML" 注解,系统认为时类自己添加的控件,不会与 fxml 文件中同名控件绑定,系统不会自动初始化,值为 null;添加 "@FXML" 注解,系统会自动绑定到 fxml 文件中的同名控件,会自动给初始化为 MenuItem 的实例。注意字段与方法的区别,如果在 fxml 中定义方法,在 java 文件中必须有同名的方法,而且方法前要加 "@FXML" 注释。
示例如下:创建一个有 menuBar、menuItem 的窗体,在 fxml 中定义 menuItem 的 id 和 Action,在 ***Controller 中操作控件 menuItem 和 Action。
fmxl 文件,其中 openItem 没有设置 onAction,closeItem 设置 onAction,注意之后的两种处理方式。
<?xml version="1.0" encoding="UTF-8"?><?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?><AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch06.VHFFrameController"><children><MenuBar fx:id="menuBar" layoutY="2.0" AnchorPane.topAnchor="2.0"><menus><Menu mnemonicParsing="false" text="File"><items><MenuItem fx:id="openItem" mnemonicParsing="false" text="Open" /><MenuItem fx:id="closeItem" mnemonicParsing="false" onAction="#exitApp" text="Exit" /></items></Menu><Menu mnemonicParsing="false" text="Edit"><items><MenuItem mnemonicParsing="false" text="Delete" /></items></Menu><Menu mnemonicParsing="false" text="Help"><items><MenuItem mnemonicParsing="false" text="About" /></items></Menu></menus></MenuBar><Separator prefWidth="200.0" /></children>
</AnchorPane>
对应的 ***Controller 类,openItem 通过在 setStage 方法中绑定 setOnAction(不能在构造函数中进行绑定,只能通过其它方法绑定!!!),closeItem 通过 fxml 文件中的设置直接绑定了 exitApp 方法(注:两个 MenuItem 控件通过不同的方法进行动作绑定,一个在 fxml 文件中绑定,一个在类文件中绑定)
注意:fxml 文件中设置的控件、方法在 ***Controller 类中要通过 “@FXML” 标识方法、字段在绑定,且方法、字段名称完全一致。
package ch06;import javafx.fxml.FXML;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;/**@package ch06 @file VHFFrameController.java@date 2020/5/27@author qiaowei@version 1.0@description 与VHFFFrame.fxml文件对应的Controller类*/
public class VHFFrameController {public VHFFrameController() {operator = Operator.instance();}/**@class VHFFrameController@date 2020/5/27@author qiaowei@version 1.0@brief 打开文件选择窗口*/
// @FXMLpublic void openChooser() {if (isStage()) {operator.openFile(primaryStage); }}/**@class VHFFrameController@date 2020/5/27@author qiaowei@version 1.0@brief 设置primaryStage字段实例,当字段已经设置过,跳过设置步骤@param primaryStage 从主程序传来的主primaryStage实例*/public void setStage(Stage primaryStage) {if ( !isStage()) {this.primaryStage = primaryStage;}openItem.setOnAction(e -> openChooser());}/**@class VHFFrameController@date 2020/5/27@author qiaowei@version 1.0@brief 退出程序*/@FXMLprivate void exitApp() {operator.exitApp();}/**@class VHFFrameController@date 2020/5/27@author qiaowei@version 1.0@brief 判断primaryStage实例是否为null,为null时,返回false;反之返回true;@return true primaryStage不为null;反之返回false*/private boolean isStage() {boolean flag = false;if (null != primaryStage) {flag = true;} else {flag = false;}return flag;}@FXMLprivate MenuItem openItem;@FXMLprivate MenuItem closeItem;@FXMLprivate MenuBar menuBar;private static Operator operator;private Stage primaryStage;
}
具体操作类 Operator,实现退出程序,打开 FileChooser 窗体两个功能:
package ch06;import javafx.application.Platform;
import javafx.stage.FileChooser;
import javafx.stage.Stage;import java.io.File;/*** @author qiaowei* @version 1.0* @package ch06* @date 2020/5/27* @description*/
public class Operator {private Operator() {}public static Operator instance() {if (null == OPERATOR) {OPERATOR = new Operator();}return OPERATOR;}public void openFile(Stage stage) {FileChooser chooser = new FileChooser();File file = chooser.showOpenDialog(stage);}public void exitApp() {Platform.exit();}private static Operator OPERATOR = null;
}
JavaFX 运行类:
package ch06;import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;/*** @author qiaowei* @version 1.0* @package ch06* @date 2020/5/27* @description*/
public class VHFApp extends Application {public static void main(String[] args) {try {Application.launch(VHFApp.class, args);} catch (Exception ex) {ex.printStackTrace();}}@Overridepublic void start(Stage primaryStage) throws Exception {FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/sources/VHFFrame.fxml"));Parent root = fxmlLoader.load();
// Parent root =
// FXMLLoader.load(getClass().getResource("/sources/VHFFrame.fxml"));int width = ((int) ((AnchorPane) root).getPrefWidth());int height = ((int) ((AnchorPane) root).getPrefHeight());Scene scene = new Scene(root, width, height);primaryStage.setTitle("VHFApplication");primaryStage.setScene(scene);VHFFrameController controller = fxmlLoader.getController();controller.setStage(primaryStage);primaryStage.show();}// private static VHFFrameController controller = new VHFFrameController();
}
实现如下:
示例 2:
文件树图:
fxml 文件:指定对应的 Controller 文件,对控件 exitItem 制定了对应的方法 exitApplication。
<?xml version="1.0" encoding="UTF-8"?><!--Copyright (c) 2015, 2019, Gluon and/or its affiliates.All rights reserved. Use is subject to license terms.This file is available and licensed under the following license:Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:- Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.- Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer inthe documentation and/or other materials provided with the distribution.- Neither the name of Oracle Corporation nor the names of itscontributors may be used to endorse or promote products derivedfrom this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHTOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANYTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--><?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?><VBox prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ui.MainWindowController"><children><MenuBar VBox.vgrow="NEVER"><menus><Menu mnemonicParsing="false" text="File"><items><MenuItem mnemonicParsing="false" text="New" /><MenuItem fx:id="openItem" mnemonicParsing="false" text="Open…" /><Menu mnemonicParsing="false" text="Open Recent" /><SeparatorMenuItem mnemonicParsing="false" /><MenuItem mnemonicParsing="false" text="Close" /><MenuItem mnemonicParsing="false" text="Save" /><MenuItem mnemonicParsing="false" text="Save As…" /><MenuItem mnemonicParsing="false" text="Revert" /><SeparatorMenuItem mnemonicParsing="false" /><MenuItem mnemonicParsing="false" text="Preferences…" /><SeparatorMenuItem mnemonicParsing="false" /><MenuItem fx:id="exitItem" mnemonicParsing="false" onAction="#exitApplication" text="Quit" /></items></Menu><Menu mnemonicParsing="false" text="Edit"><items><MenuItem mnemonicParsing="false" text="Undo" /><MenuItem mnemonicParsing="false" text="Redo" /><SeparatorMenuItem mnemonicParsing="false" /><MenuItem mnemonicParsing="false" text="Cut" /><MenuItem mnemonicParsing="false" text="Copy" /><MenuItem mnemonicParsing="false" text="Paste" /><MenuItem mnemonicParsing="false" text="Delete" /><SeparatorMenuItem mnemonicParsing="false" /><MenuItem mnemonicParsing="false" text="Select All" /><MenuItem mnemonicParsing="false" text="Unselect All" /></items></Menu><Menu mnemonicParsing="false" text="Help"><items><MenuItem mnemonicParsing="false" text="About MyHelloApp" /></items></Menu></menus></MenuBar><AnchorPane maxHeight="-1.0" maxWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS"><children><TextArea layoutX="178.0" layoutY="73.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /></children></AnchorPane></children>
</VBox>
对应的 Controller:在退出程序过程中,对 openItem 按钮是否为 null 进行测试,有 @FXML 注解时,openItem 被自动绑定实例,不为 null;当注释调 @FXML 注解后,openItem 没有自动绑定实例,为 null。如果要在 Controller 类中对控件进行操作,可以实现 initialize 方法和 @FXML 注解。这样保证控件已经绑定实例,可以对比 initialize 和 setupAttributes 方法,两者中 openItem 控件的情况。FXMLLoader 首先调用默认构造函数,然后调用 initialize 方法,从而创建相应控制器的实例。首先调用构造函数,然后填充所有 @FXML 带注释的字段,最后调用 initialize ()。因此,构造函数无法访问引用在 fxml 文件中定义的组件的 @FXML 注解字段,而 initialize 方法可以访问这些注解字段。
package ui;import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.MenuItem;import java.net.URL;
import java.util.ResourceBundle;/*************************************************************************************************** @copyright 2003-2022* @package ui* @file MainWindowController.java* @date 2022/5/2 22:54* @author qiao wei* @version 1.0* @brief MainWindow.fxml的绑定类。* @history
**************************************************************************************************/
public class MainWindowController {public MainWindowController() {setupAttributes();}@FXMLpublic void initialize() {if (null != openItem) {openItem.setOnAction(e -> exitApplication());}}public void setupAttributes() {if (null != openItem) {openItem.setOnAction(e -> openFile());}}private void openFile() {}@FXMLprivate void exitApplication() {if (null != openItem) {System.out.println("测试@FXML注释作用");}Platform.exit();}@FXMLprivate MenuItem openItem;/*********************************************************************************************** @date 2022/5/2 22:48* @author qiao wei* @brief 退出程序按钮。不添加"@FXML"注解,系统认为时类自己添加的控件,不会与fxml文件中同名控件绑定,系统* 不会自动初始化,值为null;添加"@FXML"注解,系统会自动绑定到fxml文件中的同名控件,会自动给初始化* 为MenuItem的实例。注意字段与方法的区别,如果在fxml中定义方法,在java文件中必须有同名的方法,而且* 方法前要加"@FXML"注释。**********************************************************************************************/@FXMLprivate MenuItem exitItem;
}
启动类:
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;
import ui.MainWindowController;/**************************************************************************************************@Copyright 2003-2022@package PACKAGE_NAME@date 2022/5/2@author qiao wei@version 1.0@brief TODO@history*************************************************************************************************/
public class Main extends Application {public static void main(String[] args) {try {Application.launch(Main.class, args);} catch (Exception exception) {exception.printStackTrace();}}@Overridepublic void start(Stage primaryStage) throws Exception {FXMLLoader fxmlLoader =new FXMLLoader(getClass().getResource("/fxml/MainWindow.fxml"));Parent root = fxmlLoader.load();
// MainWindowController controller = fxmlLoader.getController();Rectangle2D rectangle2D = Screen.getPrimary().getBounds();// 获取窗体左上角初始坐标double xPosition = rectangle2D.getWidth() / 5;double yPosition = rectangle2D.getHeight() / 5;// 获取窗体尺寸int width = (int) rectangle2D.getWidth() * 2 / 3;int height = (int) rectangle2D.getHeight() * 2 / 3;// 设置窗体起始坐标、尺寸primaryStage.setScene(new Scene(root, width, height));primaryStage.setX(xPosition);primaryStage.setY(yPosition);primaryStage.setTitle("Radar Track Application");primaryStage.show();}
}
运行结果:
相关文章:

JavaFX 加载 fxml 文件
JavaFX 加载 fxml 文件主要有两种方式,第一种方式通过 FXMLLoader 类直接加载 fxml 文件,简单直接,但是有些控件目前还不知道该如何获取,所以只能显示,目前无法处理。第二种方式较为复杂,但是可以使用与 fx…...

(三)Redis——Set
SADD key value SMEMBERS 127.0.0.1:6379> SADD set aaa 1 127.0.0.1:6379> SMEMBERS set aaa 127.0.0.1:6379> SADD set aaa 0 127.0.0.1:6379> SMEMBERS set aaaSISMEMBER 判断 aaa 是否在 set 中 127.0.0.1:6379> SISMEMBER set aaa 1 127.0.0.1:6379>…...

Vue组件通信方式详解(全面版)
在Vue应用开发中,组件通信是一个重要的话题。不同的组件可能需要在不同的情况下进行数据传递和交互。Vue提供了多种方式来实现组件通信,每种方式都有其适用的场景。本文将详细介绍Vue中实现组件通信的各种方式,并为每种方式提供通俗易懂的代码…...

什么是Promise对象?它的状态有哪些?如何使用Promise处理异步操作?以及 async、await
聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ Promise对象⭐ 创建Promise对象⭐ 使用Promise处理异步操作⭐ async、await⭐ 写在最后 ⭐ 专栏简介 前端入门之旅:探索Web开发的奇妙世界 记得点击上方或者右侧链接订阅本专栏哦 几何带你启航前端之旅 欢迎来到前端入门之旅…...

Android 之自定义绘制一
绘制的基本要素 onDraw(Canvas) 绘制方法 Canvas 绘制工具 Paint 调整风格 粗细等 坐标系: x y ,3D 会有z轴,x 左到右,y 上至下,与数学中y颠倒 尺寸单位: 布局中 dp ,sp ,代码中 px;dp 为了适配不同的尺寸 绘制的关键: draw(Canvas )......(关键类:Paint) Paint.ANTI_A…...

vue3 计算两个表单得到第三个表单数据
<el-formref"ruleFormRef"label-width"150px"label-suffix":":rules"rules":disabled"drawerProps.isView":model"drawerProps.rowData"><el-form-item label"云平台名称" prop"cloudId&…...

Premiere Pro软件安装包分享(附安装教程)
目录 一、软件简介 二、软件下载 一、软件简介 Adobe Premiere Pro,简称PR,是Adobe公司开发的一款非线性视频编辑软件,被广泛应用于电影、电视剧、广告、纪录片、独立电影和音乐会等影视制作领域。它被公认为是行业内的标准工具,…...

springboot设置文件上传大小,默认是1mb
问题排查和解决过程 之前做了个项目,需要用到文件上传,启动项目正常,正常上传图片也正常,但这里图片刚好都小于1M,在代码配置文件里面也写了配置,限制大小为500M,想着就没问题(测试…...

Unity 之transform.LookAt() 调整一个物体的旋转,使其朝向指定的位置
文章目录 总的介绍补充(用于摄像机跟随的场景) 总的介绍 transform.LookAt 是 Unity 引擎中 Transform 组件的一个方法,用于调整一个物体的旋转,使其朝向指定的位置。通常情况下,它被用来使一个物体(如摄像…...

linux————haproxy
一、概述 HAProxy是一个免费的负载均衡软件,可以运行于大部分主流的Linux操作系统上(CentOS、Ubuntu、Debian、OpenSUSE、Fedora、麒麟、欧拉、UOS)。 HAProxy提供了L4(TCP)和L7(HTTP)两种负载均衡能力,具备丰富的功能。HAProxy具…...

【80天学习完《深入理解计算机系统》】第十天 3.3 条件码寄存器【CF ZF SF OF】【set】
专注 效率 记忆 预习 笔记 复习 做题 欢迎观看我的博客,如有问题交流,欢迎评论区留言,一定尽快回复!(大家可以去看我的专栏,是所有文章的目录) 文章字体风格: 红色文字表示&#…...

使用WSL修改docker文件存储位置
按照以下说明将其重新定位到其他驱动器/目录,并保留所有现有的Docker数据。 首先,右键单击Docker Desktop图标关闭Docker桌面,然后选择退出Docker桌面,然后,打开命令提示符: wsl --list -v您应该能够看到&a…...

软件设计师学习笔记6-存储系统
1.层次化存储体系 1.1层次化存储结构 局部性原理是层次化存储结构的支持 时空局部性:刚被访问的内容,立即又被访问(eg: 循环体 ) 空间局部性:刚被访问的内容,临近的空间很快被访问(eg:数组) 1.2层次化存储结构的分类 DRAM&…...

【TI毫米波雷达笔记】CCS雷达工程内存RAM指定(DATA_SECTION,以IWR6843AOP为例)
【TI毫米波雷达笔记】CCS雷达工程内存RAM指定(DATA_SECTION,以IWR6843AOP为例) 工程建立好以后会有一个cmd文件 此文件描述的是内存map /*----------------------------------------------------------------------------*/ /* r4f_linker…...

安卓移动应用开发实训室建设方案
一 、系统概述 安卓移动应用开发作为新一代信息技术的重点和促进信息消费的核心产业,已成为我国转变信息服务业的发展新热点:成为信息通信领域发展最快、市场潜力最大的业务领域。互联网尤其是移动互联网,以其巨大的信息交换能力和快速渗透能…...

我的编程学习过程
自信与经验 在毕业的时候就觉得繁体字很难。大陆都在使用简体字,戴季陶说这是在亡国,没有这么严 重。繁体字会意,简体字简单,中国文盲很多,为了加快经济建设的步伐,不得不牺牲很多 东西。为了解决温饱&…...

亚马逊云科技 云技能孵化营 初识机器学习
目录 前言 一、课程介绍 二、什么是机器学习 三、机器学习算法进阶过程 四、亚马逊云科技能给我们什么 总结 前言 近期参加了“亚马逊云科技 云技能孵化营”,该孵化营的亚马逊云科技培训与认证团队为开发者准备了云从业者的精要知识及入门课程,帮助…...

多种编程语言运行速度排名-10亿次除7求余数为0的数量
最佳方式是运行10次,取平均数,用时秒数显示3位小数。 因为第一次打开,可能CPU还没优化好,多次取平均,比较准确 第1次共10次,用时3秒,平均3秒 第2次共10次,用时4秒,平均3.…...

Web 应用框架 Express 构建 RESTful API
Express框架 Express 是 Node.js 平台上最常用的 Web 应用框架之一,它简洁、灵活且易于使用。Express 提供了一组强大的功能和工具,可以帮助开发者快速构建 Web 应用程序和 RESTful API。 以下是 Express 框架的一些主要特点和功能: 轻量级…...

Orchestrator介绍一 简介安装与web端管理
目录 一 Orchestrator简介 二 Orchestrator功能 1 Discovery(发现复制拓扑) 2 Refactoring(重构复制拓扑) 3 Recovery(恢复主库故障) 三 orchestrator支持的操作方式 四 部署要求 五 下载 六 安装 1 下载软件包 2 解压软件包 3 创建账号 第一种是 orc后端MySQL数据…...

【C++心愿便利店】No.3---内联函数、auto、范围for、nullptr
文章目录 前言🌟一、内联函数🌏1.1.面试题🌏1.2.内联函数概念🌏1.3.内联函数特性 🌟二、auto关键字🌏2.1.类型别名思考🌏2.2.auto简介🌏2.3.auto的使用细节🌏2.4.auto不能…...

CV:边缘检测的算法包含 Prewitt、Sobel、Laplacian 和 Canny。
目录 1. 边缘检测(Prewitt) 2. 边缘检测(Sobel) 3. 边缘检测(Laplacian) 3. 边缘检测(Canny) 边缘检测的算法包含 Prewitt、Sobel、Laplacian 和 Canny。 人在图像识别上具有难…...

【算法系列篇】前缀和
文章目录 前言什么是前缀和算法1.【模板】前缀和1.1 题目要求1.2 做题思路1.3 Java代码实现 2. 【模板】二维前缀和2.1 题目要求2.2 做题思路2.3 Java代码实现 3. 寻找数组的中心下标3.1 题目要求3.2 做题思路3.3 Java代码实现 4. 除自身以外的数组的乘积4.1 题目要求4.2 做题思…...

若依移动端Ruoyi-App 项目的后端项目入门
后端项目运行 运行报错 Error creating bean with name sysConfigServiceImpl: Invocation of init method failed 数据库创建了。 代码连接数据库地方了也匹配上了。但是还是报错。 分析 : 想起来我电脑从来没有安装过redis 下载安装redis到windows 链接&…...

(学习笔记-调度算法)内存页面置换算法
在了解内存页面置换算法前,我们得先了解 缺页异常(缺页中断)。 当 CPU 访问的页面不在物理内存中时,便会产生一个缺页中断,请求操作系统将缺页调入到物理内存。那它与一般的中断主要区别在于: 缺页中断在指令执行 [期…...

行为型模式-观察者模式
1.观察者设计模式* 定义:当对象间存在一对多关系时,则使用观察者模式(Observer Pattern)。比如,当一个对象被修改时,则会自动通知依赖它的对象。观察者模式属于行为型模式。 意图:定义对象间的…...

前端面试:【新技术与趋势】WebAssembly、Serverless、GraphQL
在不断演进的技术领域中,WebAssembly、Serverless和GraphQL都是备受关注的新技术和趋势。它们改变了软件开发、部署和数据传输的方式,为开发者提供了更多的选择和灵活性。 1. WebAssembly(Wasm): 简介: Web…...

【ubuntu】 20.04 网络连接器图标不显示、有线未托管、设置界面中没有“网络”选项等问题解决方案
问题 在工作中 Ubuntu 20.04 桌面版因挂机或不当操作,意外导致如下问题 1、 Ubuntu 网络连接图标消失 2、 有线未托管 上图中展示的是 有线 已连接 ,故障的显示 有限 未托管 或其他字符 3、 ”设置“ 中缺少”网络“选项 上图是设置界面,…...

SpringCloud/SpringBoot多模块项目中配置公共AOP模块实现打印子模块Controller所有请求参数与日志
项目中遇到多个模块需要打印Controller请求日志,在每个模块里面加AOP并且配置单独的切面笔者认为代码冗余,于是乎就打算把AOP日志打印抽离成一个公共模块,谁想用就引入Maven坐标就行。 定义公共AOP模块 并编写AOP工具 AOP模块pom.xml如下 &…...

【GeoDa实用技巧100例】022:geoda生成空间权重矩阵(邻接矩阵、距离矩阵)
geoda生成空间权重矩阵(邻接矩阵、距离矩阵),车式矩阵、后式矩阵、K邻接矩阵。 文章目录 一、概述二、“车式”邻接的gal文档生成三、“后式”邻接gal文档生成四、k最近邻居gat文档生成五、查看gal和gat文档一、概述 空间权重矩阵(或相应的表格形式)一般需要用计算机软件生…...