jbase编译与部署的优化
上一篇的演示只是涉及自动编译业务脚本。演示时候工程编译是超级慢的。因为把静态资源放在了Web工程下,每次编译都要拷贝,运行起码是1分钟,不能忍受,为此思考工程结构改解决这个问题,顺带方便开发的发布。运行WebLoader能达到5秒内把网站启动,同时打开辅助的页面打开器。
老的结构是这样子的,为了编译运行时候借助tomcat一起发布静态资源,就把静态资源放Web工程,导致的问题就是每次编译都要拷贝静态资源,超级慢,同时还要配idea的Tomcat设置

调整工程结构,把WebUI拆成WebBase和WebLoader两部分,WebBase只包含网站的servlet基础,剔除静态资源和业务脚本,WebLoader是一个控制台,负载加载Web,同时放静态资源和Java业务脚本

简化后的WebBase,平时不编译,涉及到调用和主体变动才编译得到WEB-INF拷贝到WebLoader

WebLoader是控制台程序复杂驱动Tomcat的停止和启动脚本,同时启动实现的页面打开器,他里面加上静态资源也Java业务脚本,既能让.java享受语法检查,又不用编译拷贝,同时发布时候只要拷贝WebSrc即可

加载器逻辑
package WebLoader;import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.*;
import java.nio.file.Paths;
import java.util.Scanner;//网站加载器,引导加载网站
public class Main {//加载入口public static void main(String[] args) {System.out.println("本控制台将负责引导启动网站");try{File directory = new File("");// 参数为空String courseFile = directory.getCanonicalPath();System.out.println(courseFile);String binPath= Paths.get(courseFile,"WebSrc","bin").toString();String stopBatPath= Paths.get(courseFile,"WebSrc","bin","shutdown.bat").toString();String startBatPath= Paths.get(courseFile,"WebSrc","bin","startup.bat").toString();//结束打开页面工具KillProcess("DevOpenPage.exe");System.out.println("尝试停止站点");System.out.println("执行脚本:"+stopBatPath);TryExecCmd(stopBatPath,binPath);//启动页面打开工具String openPageUtil= Paths.get(courseFile,"WebSrc","webapps","ankilis","DevOpenPage","DevOpenPage.exe").toString();StartExe(openPageUtil,binPath);System.out.println("尝试启动站点");System.out.println("执行脚本:"+startBatPath);TryExecCmd(startBatPath,binPath);}catch (Exception ex){System.out.println(ex.getMessage());}}//结束指定名称进程//processName:进程名public static void KillProcess(String processName) {try {String line;Process p = Runtime.getRuntime().exec(System.getenv("windir") + "\\system32\\" + "tasklist.exe");BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));while ((line = input.readLine()) != null) {if (line.contains(processName)) {String processId = line.split("\\s+")[1];Runtime.getRuntime().exec("taskkill /F /PID " + processId);System.out.println("Process " + processName + " has been killed.");}}input.close();} catch (IOException e) {e.printStackTrace();}}//启动Exe//cmdStr:命令串//runDir:运行路径private static void StartExe(String cmdStr,String runDir){File directory = new File(runDir);try{System.out.println("启动:"+cmdStr);// 创建进程并执行命令Process process = Runtime.getRuntime().exec(cmdStr,null,directory);}catch (Exception ex){System.out.println(ex.getMessage());}}//执行cmd//cmdStr:命令串//runDir:运行路径private static void TryExecCmd(String cmdStr,String runDir){File directory = new File(runDir);try{System.out.println("执行:"+cmdStr);// 创建进程并执行命令Process process = Runtime.getRuntime().exec(cmdStr,null,directory);// 获取命令行程序的输出结果BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));String line;while ((line = reader.readLine()) != null) {System.out.println(line);}// 等待命令行程序执行完毕int exitCode=process.waitFor();// 关闭资源reader.close();System.out.println("返回:"+exitCode);}catch (Exception ex){System.out.println(ex.getMessage());}}
}
WebSrc内嵌的是一个Tomcat

静态资源和业务脚本在这里

同时为了内嵌Tomcat改造了他的startup.bat和shutdown.bat
startup.bat
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem ---------------------------------------------------------------------------setlocalcd ..
set "CATALINA_HOME=%cd%"rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHomeset "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExecrem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgscall "%EXECUTABLE%" start %CMD_LINE_ARGS%:end
shutdown.bat
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.rem ---------------------------------------------------------------------------
rem Stop script for the CATALINA Server
rem ---------------------------------------------------------------------------setlocalcd ..
set "CATALINA_HOME=%cd%"rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHomeset "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExecrem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgscall "%EXECUTABLE%" stop %CMD_LINE_ARGS%:end
用C#实现页面打开器方便开发打开页面

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;namespace DevOpenPage
{public partial class FrmMian : Form{/// <summary>/// 写日志/// </summary>/// <param name="str"></param>private delegate void WriteLog(string str);/// <summary>/// java文件集合/// </summary>private List<Dto> list = new List<Dto>();/// <summary>/// 静态文件路径/// </summary>string StaticFilesPath = "";public FrmMian(){InitializeComponent();}/// <summary>/// 加载函数/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void Form1_Load(object sender, EventArgs e){DirectoryInfo di = new DirectoryInfo(Application.StartupPath);StaticFilesPath = di.Parent.FullName;LoadTree();WriteLogToUI("本程序路径:" + Path.Combine(AppContext.BaseDirectory, "DevOpenPage.exe"));Task.Run(() =>{System.Threading.Thread.Sleep(7000);ChomeViewUtil.OpenChrome("http://localhost:8080/ankilis/login/form/Login.aspx");});}/// <summary>/// 加载数/// </summary>private void LoadTree(){treeViewMian.Nodes.Clear();list.Clear();TreeNode root = new TreeNode();root.Text = @"ankilis";root.Tag = StaticFilesPath;treeViewMian.Nodes.Add(root);BindChild(root);root.Expand();}/// <summary>/// 回调/// </summary>/// <param name="sender"></param>/// <param name="certificate"></param>/// <param name="chain"></param>/// <param name="errors"></param>/// <returns></returns>private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors){//总是接受 return true;}/// <summary>/// 绑定子节点/// </summary>/// <param name="fNode"></param>private bool BindChild(TreeNode fNode){string path = fNode.Tag.ToString();//父目录DirectoryInfo fDir = new DirectoryInfo(path);FileSystemInfo[] finfos = fDir.GetFileSystemInfos();bool HasFile = false;foreach (FileSystemInfo f in finfos){if (fDir.GetType() != f.GetType()){if(txtFilter.Text!=""&&(!f.Name.ToLower().Contains(txtFilter.Text.ToLower()))){continue;}}TreeNode node = new TreeNode();node.Text = f.Name;node.Tag = f.FullName;if(f.Extension==".java"){Dto dto = new Dto();dto.FullName = f.FullName.Replace(".java",".ashx");dto.LastTime = f.LastWriteTime;list.Add(dto);}if (f.Extension == ".aspx"|| f.Extension == ".html" || f.Extension == ".java"){node.ForeColor = Color.Blue;}//是文件夹时才递归调用自己if (fDir.GetType() == f.GetType()) {bool ChildHasFile=BindChild(node);if(ChildHasFile==true){HasFile = true;fNode.Nodes.Add(node);}}else{HasFile = true;fNode.Nodes.Add(node);}}return HasFile;}/// <summary>/// 双击打开/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void treeViewMian_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e){string fullPath = e.Node.Tag.ToString();if (fullPath.Contains(".aspx")|| e.Node.Tag.ToString().Contains(".html") || e.Node.Tag.ToString().Contains(".java")){ChomeViewUtil.OpenChrome("http://localhost:8080/"+e.Node.FullPath.Replace(".java", ".ashx"));WriteLogToUI("打开" + "http://localhost:8080/" + e.Node.FullPath.Replace(".java", ".ashx"));}else{if(File.Exists(fullPath)){Process process = new Process();process.StartInfo.FileName = "cmd.exe";process.StartInfo.UseShellExecute = false;process.StartInfo.RedirectStandardInput = false;process.StartInfo.RedirectStandardOutput = false;process.StartInfo.RedirectStandardError = false;process.StartInfo.CreateNoWindow = true;process.StartInfo.Arguments = @"/c " + fullPath;process.Start();WriteLogToUI("打开" + fullPath);}}}/// <summary>/// 刷新树/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void btnRefresh_Click(object sender, EventArgs e){list.Clear();LoadTree();WriteLogToUI("刷新目录成功");}/// <summary>/// 写日志到界面/// </summary>/// <param name="str"></param>private void WriteLogToUI(string str){WriteLog txthandler = new WriteLog(SetLogTxt);txtLog.Invoke(txthandler, new object[] { str });}/// <summary>/// 设置日志控件文本/// </summary>/// <param name="str"></param>private void SetLogTxt(string str){txtLog.Text += DateTime.Now.ToString("hh:mm:ss# ")+str + "\n";}/// <summary>/// 实体/// </summary>public class Dto{/// <summary>/// 全名/// </summary>public string FullName{get;set;}/// <summary>/// 最后修改时间/// </summary>public DateTime LastTime{get;set;}}/// <summary>/// 模糊查询/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void txtFilter_KeyDown(object sender, KeyEventArgs e){if(e.KeyCode==Keys.Enter){LoadTree();}}}
}
谷歌打开工具
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;namespace DevOpenPage
{/// <summary>/// 用谷歌打开url工具/// </summary>public static class ChomeViewUtil{/// <summary>/// 谷歌打开url/// </summary>/// <param name="path">url</param>/// <param name="isApp">是否app模式</param>public static void OpenChrome(string path, bool isApp = false){string chromePath = "";bool IsChrome = TryGetSoftwarePath("chrome", out chromePath);if (IsChrome && chromePath.Length > 0){Console.WriteLine("驱动Chrome打开登录链接");if (isApp == true){System.Diagnostics.Process.Start(chromePath, "--app=" + path);}else{System.Diagnostics.Process.Start(chromePath, path);}}else{Console.WriteLine("没安装Chrome,驱动默认浏览器打开登录链接");//调用系统默认的浏览器 System.Diagnostics.Process.Start(path);}}/// <summary>/// 获取某个安装文件的执行路径/// </summary>/// <param name="softName">软件名</param>/// <param name="path">路径</param>/// <returns></returns>public static bool TryGetSoftwarePath(string softName, out string path){string strPathResult = string.Empty;string strKeyName = ""; object objResult = null;Microsoft.Win32.RegistryValueKind regValueKind;Microsoft.Win32.RegistryKey regKey = null;Microsoft.Win32.RegistryKey regSubKey = null;try{//Read the key regKey = Microsoft.Win32.Registry.LocalMachine;regSubKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\" + softName.ToString() + ".exe", false);//如果在LocalMachine获取不到,可以在CurrentUser里获取if (regSubKey == null){regKey = Microsoft.Win32.Registry.CurrentUser;regSubKey = regKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\" + softName.ToString() + ".exe", false);}if(regSubKey==null){path = "";return false;}//Read the path objResult = regSubKey.GetValue(strKeyName);regValueKind = regSubKey.GetValueKind(strKeyName);//Set the path if (regValueKind == Microsoft.Win32.RegistryValueKind.String){strPathResult = objResult.ToString();}}catch (System.Security.SecurityException ex){path = "";System.Windows.Forms.MessageBox.Show("你没有读取注册表的权限! "+ex.Message);}catch (Exception ex){path = "";System.Windows.Forms.MessageBox.Show("读取注册表错误! " + ex.Message);}finally{if (regKey != null){regKey.Close();regKey = null;}if (regSubKey != null){regSubKey.Close();regSubKey = null;}}if (strPathResult != string.Empty){path = strPathResult;return true;}else{path = "";return false;}}}
}
Linux部署
先安装jdk
[root@localhost ~]# yum install java-1.8.0-openjdk* -y
然后打开8080端口和查看jdk版本
[root@localhost ~]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]# java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[root@localhost ~]# java -version
openjdk version "1.8.0_382"
OpenJDK Runtime Environment (build 1.8.0_382-b05)
OpenJDK 64-Bit Server VM (build 25.382-b05, mixed mode)
然后尝试启动测试网站,这里要给startup.sh、catalina.sh、shutdown.sh执行权限,给WebSrc目录权限,否则javac无法编译,别的没什么主意的。

[root@localhost ~]# bash /WebSrc/bin/startup.sh
Cannot find /WebSrc/bin/catalina.sh
The file is absent or does not have execute permission
This file is needed to run this program
[root@localhost ~]# chmod +x /WebSrc/bin/startup.sh
[root@localhost ~]# bash /WebSrc/bin/startup.sh
Cannot find /WebSrc/bin/catalina.sh
The file is absent or does not have execute permission
This file is needed to run this program
[root@localhost ~]# chmod +x /WebSrc/bin/catalina.sh
[root@localhost ~]# bash /WebSrc/bin/startup.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@localhost ~]# bash /WebSrc/bin/shutdown.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
[root@localhost ~]# bash /WebSrc/bin/shutdown.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Nov 06, 2023 9:02:45 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact [localhost:8005] (base port [8005] and offset [0]). Tomcat may not be running.
Nov 06, 2023 9:02:45 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Error stopping Catalina
java.net.ConnectException: Connection refused (Connection refused)at java.net.PlainSocketImpl.socketConnect(Native Method)at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)at java.net.Socket.connect(Socket.java:607)at java.net.Socket.connect(Socket.java:556)at java.net.Socket.<init>(Socket.java:452)at java.net.Socket.<init>(Socket.java:229)at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:667)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:393)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483)[root@localhost ~]# bash /WebSrc/bin/startup.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# bash /WebSrc/bin/shutdown.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
[root@localhost ~]# bash /WebSrc/bin/startup.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@localhost ~]# bash /WebSrc/bin/shutdown.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
[root@localhost ~]# bash /WebSrc/bin/startup.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@localhost ~]# chmod -R +777 /WebSrc
[root@localhost ~]# bash /WebSrc/bin/shutdown.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
[root@localhost ~]# bash /WebSrc/bin/startup.sh
Using CATALINA_BASE: /WebSrc
Using CATALINA_HOME: /WebSrc
Using CATALINA_TMPDIR: /WebSrc/temp
Using JRE_HOME: /usr
Using CLASSPATH: /WebSrc/bin/bootstrap.jar:/WebSrc/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
部署只要上传WebSrc文件夹到Linux或者直接运行Windows下的WebSrc/bin的启动脚本(前提是安装jdk)。Linux上设置文件夹权限和启动停止脚本权限,非常简单。
CentOS7上发布效果



改业务代码测试


轻松加愉快,开发和Linux发布都很简单,不依赖Maven、不用配开发idea的tomcat,不用niginx代理前后台。前后台做到分而不离。下一阶段实现代码生成器和通用码表,通用码表可以解决百分之80左右的基础维护界面。生效的百分之二十的维护界面借助代码生成器生成的代码解决这里面的百分之80工作量,从而极大降低基础维护的开发量,等于剩下约百分之四。
通用码表原理
代码生成器原理
相关文章:
jbase编译与部署的优化
上一篇的演示只是涉及自动编译业务脚本。演示时候工程编译是超级慢的。因为把静态资源放在了Web工程下,每次编译都要拷贝,运行起码是1分钟,不能忍受,为此思考工程结构改解决这个问题,顺带方便开发的发布。运行WebLoade…...
Filter 和 Listener
Filter 表示过滤器。是JavaWeb三大组件(Servlet、Filter、Listener)之一。 过滤器可以把对资源的请求 拦截 下来。浏览器可以访问服务器上所有的资源,而在访问到这些资源之前可以使用过滤器拦截下来,也就是说在访问资源之前会先经…...
【正则表达式】中的“\b“
正则表达式是一种用于匹配字符串的强大工具,它可以用于各种编程语言中,可以用来在文本中查找、替换或验证符合某种规则的内容。 正则表达式中有很多特殊的符号,称为元字符,它们有着特殊的含义和作用。其中,“\b” 是其…...
FPGA高端项目:图像采集+GTP+UDP架构,高速接口以太网视频传输,提供2套工程源码加QT上位机源码和技术支持
目录 1、前言免责声明本项目特点 2、相关方案推荐我这里已有的 GT 高速接口解决方案我这里已有的以太网方案 3、设计思路框架设计框图视频源选择OV5640摄像头配置及采集动态彩条视频数据组包GTP 全网最细解读GTP 基本结构GTP 发送和接收处理流程GTP 的参考时钟GTP 发送接口GTP …...
数据库系统原理与实践 笔记 #7
文章目录 数据库系统原理与实践 笔记 #7数据库设计和E-R模型(续)转换为关系模式具有简单属性的实体集的表示复合属性多值属性联系集的表示模式的冗余—合并 实体-联系设计问题设计问题联系属性的布局 扩展的E-R特性特化概化属性继承特化/概化的设计约束聚集E-R图表示方法总结E-…...
【CesiumJS】(1)Hello world
介绍 Cesium 起源于2011年,初衷是航空软件公司(Analytical Graphics, Inc.)的一个团队要制作世界上最准确、性能最高且具有时间动态性的虚拟地球。取名"Cesium"是因为元素铯Cesium让原子钟非常准确(1967年,人们依据铯原子的振动而对…...
Docker 学习路线 5:在 Docker 中实现数据持久化
Docker 可以运行隔离的容器,包括应用程序和其依赖项,与主机操作系统分离。默认情况下,容器是临时的,这意味着容器中存储的任何数据在终止后都将丢失。为了解决这个问题并在容器生命周期内保留数据,Docker 提供了各种数…...
linux下使用vscode对C++项目进行编译
项目的目录结构 头文件swap.h 在自定义的头文件中写函数的声明。 // 函数的声明 void swap(int a,int b);swap.cpp 导入函数的声明,写函数的定义 #include "swap.h" // 双引号表示自定义的头文件 #include <iostream> using namespace std;// 函…...
LangChain+LLM实战---ChatGPT的即时插件套件制作
英文原文:Instant Plugins for ChatGPT: Introducing the Wolfram ChatGPT Plugin Kit 在一分钟内构建一个新插件 几周前,我们与OpenAI合作发布了Wolfram插件,使ChatGPT可以使用Wolfram语言和Wolfram|Alpha作为工具,在ChatGPT内部…...
包装印刷行业万界星空科技云MES解决方案
印刷业的机械化程度在国内制造行业内算是比较高的,不算是劳动密集型企业。如书本的装订、包装的模切、烫金、糊盒等都已经有了全自动设备。印刷厂除了部分手工必须采用人工外,大部分都可以采用机器,也就意味着可以由少量工人生产出大量产品。…...
Python教程---计算机语言简介
1.计算机编程语言的发展历程 计算机语言发展经历了三个阶段: 机器语言 - 机器语言通过二进制编码来编写程序,打孔织带机。 - 执行效率好,编写起来太麻烦 符号语言(汇编) - 使用符号来代替机器码 - 编写程序时…...
rhcsa-文件内容显示
浏览普通文件内容 浏览文件的命令 命令常用选项说明cat -n 对输出内容中的所有行标注行号 -b 对输出内容中的非空行标注行号 查看文件的内容head-num 指定需要显示文件num行的内容默认查看文前十行的内容tail -num 指定需要显示文件num行的内容 -f 使tail不停的去读取显示文…...
宠物养成猫狗商城门店问诊档案流量主小程序开发
宠物养成猫狗商城门店问诊档案流量主小程序开发 猫狗宠物养成商城门店问诊档案流量主小程序开发,这是一个充满趣味性和创新性的项目。通过将宠物养成游戏与商城、问诊服务、社交功能等相结合,为用户提供一站式的宠物养育体验。 在宠物养成方面&#x…...
应用安全四十二:SSO安全
一、什么是SSO SSO是单点登录(Single Sign On)的缩写,是指在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统。这种方式减少了由登录产生的时间消耗,辅助了用户管理,是比较流行的企业业务整合的解决方案之一。 身份验证过程依赖于双方之间的信任关…...
【行云流水线实践】基于“OneBuild”方法对镜像进行快速装箱 | 京东云技术团队
在云原生领域,无论使用哪种编排调度平台,Kubernetes,DockerSwarm,OpenShift等,业务都需要基于镜像进行交付,我们在内部实践“Source-to-image”和链式构建,总而总结出“OneBuild”模式。 其核心…...
软件开发必备神器!一文读懂10款热门看板工具推荐!
看板(Kanban)是一种流行的框架,用于实施敏捷和DevOps软件开发。它要求实时沟通每个人的能力,并全面透明地展示正在进行的工作。工作项目在看板上以可视化方式表示,使项目经理和所有团队成员可以随时查看每个工作的状态…...
怎样提取视频提取的人声或伴奏?
有些小伙伴们进行音视频创作时,可能会需要提取音频的人声或者是伴奏。这里给大家推荐一个音分轨人声分离软件,支持一键提取音频人声和一键提取伴奏功能,可批量导入文件同步提取,简单高效,是音视频创作者的不二选择&…...
SpringBoot概述
SpringBoot是Spring提供的一个子项目,用于快速构建Spring应用程序。 SpringFramework:核心功能SpringData:数据获取SpringSecurity:认证授权SpringAMQP:消息传递SpringCloud:服务治理 SpringBoot新特性&…...
深度学习框架TensorFlow.NET环境搭建1(C#)
测试环境 visual studio 2017 window10 64位 测试步骤如下: 1 新建.net framework控制台项目,工程名称为TensorFlowNetDemo,.net framework的版本选4.7.2,如下图: 2 分别安装TensorFlow.NET包(先装)和SciSharp.…...
Git客户端软件 Tower mac中文版特点说明
Tower mac是一款Mac OS X系统上的Git客户端软件,它提供了丰富的功能和工具,帮助用户更加方便地管理和使用Git版本控制系统。 Tower mac软件特点 1. 界面友好:Tower的界面友好,使用户能够轻松地掌握软件的使用方法。 2. 多种Git操…...
[2025CVPR]DeepVideo-R1:基于难度感知回归GRPO的视频强化微调框架详解
突破视频大语言模型推理瓶颈,在多个视频基准上实现SOTA性能 一、核心问题与创新亮点 1.1 GRPO在视频任务中的两大挑战 安全措施依赖问题 GRPO使用min和clip函数限制策略更新幅度,导致: 梯度抑制:当新旧策略差异过大时梯度消失收敛困难:策略无法充分优化# 传统GRPO的梯…...
CMake基础:构建流程详解
目录 1.CMake构建过程的基本流程 2.CMake构建的具体步骤 2.1.创建构建目录 2.2.使用 CMake 生成构建文件 2.3.编译和构建 2.4.清理构建文件 2.5.重新配置和构建 3.跨平台构建示例 4.工具链与交叉编译 5.CMake构建后的项目结构解析 5.1.CMake构建后的目录结构 5.2.构…...
在 Nginx Stream 层“改写”MQTT ngx_stream_mqtt_filter_module
1、为什么要修改 CONNECT 报文? 多租户隔离:自动为接入设备追加租户前缀,后端按 ClientID 拆分队列。零代码鉴权:将入站用户名替换为 OAuth Access-Token,后端 Broker 统一校验。灰度发布:根据 IP/地理位写…...
Java - Mysql数据类型对应
Mysql数据类型java数据类型备注整型INT/INTEGERint / java.lang.Integer–BIGINTlong/java.lang.Long–––浮点型FLOATfloat/java.lang.FloatDOUBLEdouble/java.lang.Double–DECIMAL/NUMERICjava.math.BigDecimal字符串型CHARjava.lang.String固定长度字符串VARCHARjava.lang…...
如何在最短时间内提升打ctf(web)的水平?
刚刚刷完2遍 bugku 的 web 题,前来答题。 每个人对刷题理解是不同,有的人是看了writeup就等于刷了,有的人是收藏了writeup就等于刷了,有的人是跟着writeup做了一遍就等于刷了,还有的人是独立思考做了一遍就等于刷了。…...
C++ Visual Studio 2017厂商给的源码没有.sln文件 易兆微芯片下载工具加开机动画下载。
1.先用Visual Studio 2017打开Yichip YC31xx loader.vcxproj,再用Visual Studio 2022打开。再保侟就有.sln文件了。 易兆微芯片下载工具加开机动画下载 ExtraDownloadFile1Info.\logo.bin|0|0|10D2000|0 MFC应用兼容CMD 在BOOL CYichipYC31xxloaderDlg::OnIni…...
精益数据分析(97/126):邮件营销与用户参与度的关键指标优化指南
精益数据分析(97/126):邮件营销与用户参与度的关键指标优化指南 在数字化营销时代,邮件列表效度、用户参与度和网站性能等指标往往决定着创业公司的增长成败。今天,我们将深入解析邮件打开率、网站可用性、页面参与时…...
算法笔记2
1.字符串拼接最好用StringBuilder,不用String 2.创建List<>类型的数组并创建内存 List arr[] new ArrayList[26]; Arrays.setAll(arr, i -> new ArrayList<>()); 3.去掉首尾空格...
return this;返回的是谁
一个审批系统的示例来演示责任链模式的实现。假设公司需要处理不同金额的采购申请,不同级别的经理有不同的审批权限: // 抽象处理者:审批者 abstract class Approver {protected Approver successor; // 下一个处理者// 设置下一个处理者pub…...
【 java 虚拟机知识 第一篇 】
目录 1.内存模型 1.1.JVM内存模型的介绍 1.2.堆和栈的区别 1.3.栈的存储细节 1.4.堆的部分 1.5.程序计数器的作用 1.6.方法区的内容 1.7.字符串池 1.8.引用类型 1.9.内存泄漏与内存溢出 1.10.会出现内存溢出的结构 1.内存模型 1.1.JVM内存模型的介绍 内存模型主要分…...
