前端验证码

一、基础验证码

gVerify.js:

!(function (window, document) {function GVerify(options) { //创建一个图形验证码对象,接收options对象为参数this.options = { //默认options参数值id: "", //容器IdcanvasId: "verifyCanvas", //canvas的IDwidth: "100", //默认canvas宽度height: "30", //默认canvas高度type: "blend", //图形验证码默认类型blend:数字字母混合类型、number:纯数字、letter:纯字母code: ""}if (Object.prototype.toString.call(options) == "[object Object]") {//判断传入参数类型for (var i in options) { //根据传入的参数,修改默认参数值this.options[i] = options[i];}} else {this.options.id = options;}this.options.numArr = "0,1,2,3,4,5,6,7,8,9".split(",");this.options.letterArr = getAllLetter();this._init();this.refresh();}GVerify.prototype = {/**版本号**/version: '1.0.0',/**初始化方法**/_init: function () {var con = document.getElementById(this.options.id);var canvas = document.createElement("canvas");this.options.width = con.offsetWidth > 0 ? con.offsetWidth : "100";this.options.height = con.offsetHeight > 0 ? con.offsetHeight : "30";canvas.id = this.options.canvasId;canvas.innerHTML = "您的浏览器版本不支持canvas";canvas.width = this.options.width;canvas.height = this.options.height;canvas.style.cursor = "pointer";canvas.style.marginTop = '2px';canvas.style.width = "100px";canvas.style.height = "38px";con.appendChild(canvas);var parent = this;canvas.onclick = function () {parent.refresh();}},/**生成验证码**/refresh: function () {this.options.code = "";var canvas = document.getElementById(this.options.canvasId);if (canvas.getContext) {var ctx = canvas.getContext('2d');} else {alert('您的浏览器版本不支持canvas,请使用IE9以上版本的浏览器!');return;}ctx.textBaseline = "middle";ctx.fillStyle = randomColor(180, 240);ctx.fillRect(0, 0, this.options.width, this.options.height);if (this.options.type == "blend") { //判断验证码类型var txtArr = this.options.numArr.concat(this.options.letterArr);} else if (this.options.type == "number") {var txtArr = this.options.numArr;} else {var txtArr = this.options.letterArr;}/**生成四个字符**/for (var i = 1; i <= 4; i++) {var txt = txtArr[randomNum(0, txtArr.length)];this.options.code += txt;ctx.font = randomNum(this.options.height / 2, this.options.height) + 'px SimHei'; //随机生成字体大小ctx.fillStyle = randomColor(50, 160); //随机生成字体颜色ctx.shadowOffsetX = randomNum(-3, 3);ctx.shadowOffsetY = randomNum(-3, 3);ctx.shadowBlur = randomNum(-3, 3);ctx.shadowColor = "rgba(0, 0, 0, 0.3)";var x = this.options.width / 5 * i - 5; //根据需要向左偏移5pxvar y = this.options.height / 2;var deg = randomNum(-30, 30);/**设置旋转角度和坐标原点**/ctx.translate(x, y);ctx.rotate(deg * Math.PI / 180);ctx.fillText(txt, 0, 0);/**恢复旋转角度和坐标原点**/ctx.rotate(-deg * Math.PI / 180);ctx.translate(-x, -y);}/**绘制干扰线**/for (var i = 0; i < 4; i++) {ctx.strokeStyle = randomColor(40, 180);ctx.beginPath();ctx.moveTo(randomNum(0, this.options.width), randomNum(0, this.options.height));ctx.lineTo(randomNum(0, this.options.width), randomNum(0, this.options.height));ctx.stroke();}/**绘制干扰点**/for (var i = 0; i < this.options.width / 4; i++) {ctx.fillStyle = randomColor(0, 255);ctx.beginPath();ctx.arc(randomNum(0, this.options.width), randomNum(0, this.options.height), 1, 0, 2 * Math.PI);ctx.fill();}},/**验证验证码**/validate: function (code) {var code = code.toLowerCase();var v_code = this.options.code.toLowerCase();if (code == v_code) {return true;} else {this.refresh();return false;}}}/**生成字母数组**/// function getAllLetter() {// 	var letterStr = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";// 	return letterStr.split(",");// }/**生成字母和汉字数组**/function getAllLetter() {var letterStr = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";var hanziStr = chineseUnicode; //	chineseUnicode为unicode.js里面的变量var str = letterStr + "," + hanziStr;return str.split(",");}/**生成一个随机数**/function randomNum(min, max) {return Math.floor(Math.random() * (max - min) + min);}/**生成一个随机色**/function randomColor(min, max) {var r = randomNum(min, max);var g = randomNum(min, max);var b = randomNum(min, max);return "rgb(" + r + "," + g + "," + b + ")";}window.GVerify = GVerify;
})(window, document);

验证码添加汉字:

/*常用汉字的 unicode 编码*/
/*如果要使验证码包含汉字,请配置*/
/*河东太上原党三川郡南颍九阳江泗巨水鹿齐琅会邪稽汉蜀中巴陇北西地云雁沙门谷代渔右辽平海桂象邯林郸砀薛长\u6cb3,\u4e1c,\u592a,\u4e0a,\u539f,\u515a,\u4e09,\u5ddd,\u90e1,\u5357,\u988d,\u4e5d,\u9633,\u6c5f,\u6cd7,\u5de8,\u6c34,\u9e7f,\u9f50,\u7405,\u4f1a,\u90aa,\u7a3d,\u6c49,\u8700,\u4e2d,\u5df4,\u9647,\u5317,\u897f,\u5730,\u4e91,\u96c1,\u6c99,\u95e8,\u8c37,\u4ee3,\u6e14,\u53f3,\u8fbd,\u5e73,\u6d77,\u6842,\u8c61,\u90af,\u6797,\u90f8,\u7800,\u859b,\u957f
*/
/*unicode 编码*/
//let chineseUnicode = "\u6cb3,\u4e1c,\u592a,\u4e0a,\u539f,\u515a,\u4e09,\u5ddd,\u90e1,\u5357,\u988d,\u4e5d,\u9633,\u6c5f,\u6cd7,\u5de8,\u6c34,\u9e7f,\u9f50,\u7405,\u4f1a,\u90aa,\u7a3d,\u6c49,\u8700,\u4e2d,\u5df4,\u9647,\u5317,\u897f,\u5730,\u4e91,\u96c1,\u6c99,\u95e8,\u8c37,\u4ee3,\u6e14,\u53f3,\u8fbd,\u5e73,\u6d77,\u6842,\u8c61,\u90af,\u6797,\u90f8,\u7800,\u859b,\u957f";
let chineseUnicode = "";

登录页面使用gVerify.js: 

<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><!--<title th:text="${#themes.code('cas.page.title')}"></title> 存在中文乱码问题,--><!--所以改为在messages_zh_CN.properties文件取--><title th:text="#{screen.login.header}">CAS Login</title><link rel="stylesheet" th:href="@{/themes/portal/css/element-ui.css}"/><link rel="stylesheet" th:href="@{/themes/portal/css/index.css}"/><link rel="icon" th:href="@{/themes/portal/favicon.ico}" id="icon"><script th:src="@{/themes/portal/js/vue.js}"></script><script th:src="@{/themes/portal/js/vue-resource.js}"></script><script th:src="@{/themes/portal/js/element-ui.js}"></script><script th:src="@{/themes/portal/js/jsencrypt.min.js}"></script><script th:src="@{/themes/portal/js/gVerify.js}"></script><script th:src="@{/themes/portal/js/unicode.js}"></script><style type="text/css">body {padding: 0;margin: 0;}</style>
</head><body>
<div id="app"><div v-show="!loading" class="left-image"><img class="login-img" th:src="@{themes/portal/images/loginimg.jpg}"/><img class="login-logo" th:src="@{themes/portal/images/loginlogo.png}"/></div><div class="right-form"><el-card v-show="!loading" class="card"><div><h3 class="login-title">数字化转型平台</h3></div><div><el-form :label-position="labelPosition" :model="ruleForm" method="post" th:object="${credential}" status-icon:rules="rules" @submit.native.preventref="ruleForm" class="demo-ruleForm"><div th:if="${#fields.hasErrors('*')}" class="fieldHasErr"><span th:each="err : ${#fields.errors('*')}" th:utext="${err}"class="fieldErr" id="fieldErr"/></div><div th:if="!${#fields.hasErrors('*')}" class="fieldHasErr"><span class="fieldErr">&nbsp;</span></div><label class="control-label text-right">用户名</label><el-form-item prop="userDTO"><el-input v-model.trim="ruleForm.userDTO" name="username"prefix-icon="el-icon-user"placeholder="用户名" ref="userNameInput"v-no-paste autocomplete="username"></el-input></el-form-item><label class="control-label text-right">密码</label><el-form-item prop="inputPass"><el-input type="password" v-model.trim="ruleForm.inputPass" name="inputPass"prefix-icon="el-icon-key" placeholder="密码"v-no-paste autocomplete="current-password"></el-input></el-form-item><el-form-item prop="pass" v-show="false"><el-input type="password" v-model.trim="ruleForm.pass" name="password"></el-input></el-form-item><div v-show="gVerify"><label class="control-label text-right">验证码</label><el-form-item prop="captcha" id="code_input"><el-input v-model.trim="ruleForm.captcha" name="captcha"prefix-icon="el-icon-tickets"placeholder="请输入验证码"value=""id="captcha_input"></el-input></el-form-item><div id="v_container"><div id="changeBtn"><!--换一张--></div></div></div><section class="form-check" th:if="${rememberMeAuthenticationEnabled}"><div><input type="checkbox"name="rememberMe"id="rememberMe" value="true" tabindex="5"/><label for="rememberMe" th:text="#{screen.rememberme.checkbox.title}">Remember Me</label></div></section><el-form-item><el-button type="primary" @click="submitForm('ruleForm')" class="login-submit">登&nbsp;&nbsp;录</el-button></el-form-item><input type="hidden" name="casServerLogin" v-model.trim="isCASServerLogin"/><input type="hidden" name="execution" th:value="${flowExecutionKey}"/><input type="hidden" name="_eventId" value="submit"/></el-form></div><div class="login-footer" align="center"><span class="login-copyright">©</span> <span id="copyright">Copyright © 2024 Gener Soft. All Rights Reserved. 沪ICP备15036345号</span></div></el-card></div>
</div>
<div class="pre-loader" id="pre-loader"><div class="inner one"></div><div class="inner two"></div><div class="inner three"></div>
</div>
</body><script th:inline="text" type="application/javascript">function getRequestParameter() {let url = location.search;let requestParameter = {};if (url.indexOf("?") !== -1) {let strs = url.substr(1).split('&');for (let i = 0; i < strs.length; i++) {requestParameter[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);}}return requestParameter;}function getRequestParameterBackTo() {let url = location.search;let requestParameter = {};if (url.indexOf("?") !== -1) {let strs = url.substr(1).split('back_to%3D');if (strs.length > 1) {requestParameter = unescape(strs[strs.length - 1]);} else {let strs = url.substr(1).split('service=');if (strs.length > 1) {requestParameter = unescape(strs[strs.length - 1]);}}}return requestParameter;}// 自定义指令 v-no-paste 密码框禁止粘贴Vue.directive('no-paste', {// 当绑定元素插入到DOM中inserted: function (el) {el.addEventListener('paste', function (event) {event.preventDefault();});}});new Vue({el: '#app',data() {let checkUser = (rule, value, callback) => {if (!value) {return callback(new Error('请输入用户名'))} else if (value.length > 15) {return callback(new Error('用户名长度错误'))} else {callback()}}let checkPass = (rule, value, callback) => {if (!value) {callback(new Error('请输入密码'))} else if (value.length > 15) {callback(new Error('密码长度错误'))} else {callback()}};let checkCaptcha = (rule, value, callback) => {if (this.gVerify) {if (!value) {callback(new Error('请输入验证码'))} else {callback()}} else {callback()}};return {labelPosition: 'right',loading: true,loginConfig: null,ruleForm: {inputPass: '', // 录入的密码pass: '', // 提交的密码userDTO: '[[${credential.username}]]',captcha: ''},rules: {userDTO: [{validator: checkUser, trigger: 'blur'}],inputPass: [{validator: checkPass, trigger: 'blur'}],captcha: [{validator: checkCaptcha, trigger: 'blur'}]},isCASServerLogin: false,publicKey: '',gVerify: false}},computed: {},watch: {loginConfig(nv) {this.initLoginPage()},gVerify: {immediate: true,handler(newValue) {if (newValue) {document.querySelector(".login-footer").style.marginTop = 22 + 'vh';} else {document.querySelector(".login-footer").style.marginTop = 30 + 'vh';}}}},created() {let {service} = getRequestParameter();if (service) {this.request4LoginConfig(service, this.isCASServerLogin)} else {this.isCASServerLogin = truethis.request4LoginConfig(service, this.isCASServerLogin)}let node = document.querySelector("#fieldErr")if (node) {let fieldErr = node.innerText;if (fieldErr && (fieldErr.startsWith("refreshing page..."))) {node.className = "fieldErr1";}}},mounted() {// 如果错误提示信息是“用户名和密码不匹配,还可以重试n次”/“您已连续输错密码n次,账号已锁定请稍后再试”/“用户名不存在”,启用图片验证码let node = document.querySelector("#fieldErr")if (node) {let fieldErr = node.innerText;if (fieldErr && (fieldErr.startsWith("用户名和密码不匹配,还可以重试") || fieldErr.startsWith("您已连续输错密码") || fieldErr.startsWith("用户名不存在"))) {this.gVerify = true;} else if (fieldErr && (fieldErr.startsWith("登录["))) {// 后登录账号和已登录账号用户名不同,弹窗提示先登出已登录账号再操作登录this.openMsgBox(fieldErr);} else if (fieldErr && (fieldErr.startsWith("refreshing page..."))) {// 后登录账号和已登录账号用户名相同,刷新页面即可let search = getRequestParameterBackTo();location.replace(search);}}this.$nextTick(function () {this.$refs.userNameInput.focus();})},methods: {submitForm(formName) {this.$refs[formName].validate((valid) => {if (valid) {if (this.gVerify) {//验证码是否正确let oInput = document.querySelector("#captcha_input");let res = verifyCode.validate(oInput.value);if (!res) {document.querySelector("#fieldErr").innerText = "验证码不正确";this.ruleForm.captcha = '';return false;}}//Encrypt the input password with a public keylet encrypt = new JSEncrypt({default_key_size: 1024});encrypt.setPublicKey(this.publicKey);let encrypted = encrypt.encrypt(this.ruleForm.inputPass);this.ruleForm.pass = encrypted;this.ruleForm.inputPass = this.ruleForm.inputPass.replace(/./g, '*');this.$nextTick(function () {this.loginSystem();})} else {this.$message.error('Error submit!');return false;}})},loginSystem() {this.$refs.ruleForm.$el.submit()},async logout() {this.$http.get('[[@{/logout}]]', {}).then(resp => {}).catch(e => {})},async request4LoginConfig(service, isCASServerLogin) {this.$http.post('[[@{/getLoginConfig}]]', {service, isCASServerLogin}).then(resp => {if (resp.body.publicKey) {this.publicKey = resp.body.publicKey;}/*if (resp.body.htmlTitle) {document.title = resp.body.htmlTitle;}if (resp.body.favicon) {document.querySelector('#icon').href = resp.body.favicon;}if (resp.body.backgroundImg) {let prefix = 'url('let suffix = ') no-repeat center center'let background = prefix + resp.body.backgroundImg + suffixdocument.querySelector('.login-container').style.background = background;document.querySelector('.login-container').style.backgroundSize = 'cover';}if (resp.body.copyright) {document.querySelector('#copyright').innerText = resp.body.copyright;}*/// this.loginConfig值变化可以结束预加载的动画if (resp.body.title) {this.loginConfig = {banner: resp.body.title}} else {this.loginConfig = {banner: 'Welcome!'}}this.$nextTick(function () {this.$refs.userNameInput.focus()})}).catch(e => {setTimeout(() => {this.loginConfig = {banner: 'Welcome!'}this.$refs.userNameInput.focus()})})},initLoginPage() {this.loading = false;this.stopLoading()},stopLoading() {const preLoader = document.querySelector('#pre-loader')preLoader.style.display = 'none'},openMsgBox(msg) {this.$confirm(msg, '确认信息', {distinguishCancelAndClose: true,confirmButtonText: '登出',cancelButtonText: '取消',beforeClose: (action, instance, done) => {if (action === 'confirm') {this.logout();instance.confirmButtonLoading = true;instance.confirmButtonText = '登出中...';setTimeout(() => {done();setTimeout(() => {instance.confirmButtonLoading = false;}, 100);}, 1000);} else {done();}}}).then(() => {this.$message({type: 'info',message: '登出成功'});setTimeout(() => {let search = getRequestParameterBackTo();location.replace(search);}, 1000)})}}})
</script>
<script type="text/javascript">let verifyCode = new GVerify("v_container");let oDiv = document.querySelector("#changeBtn");//看不清,换一张oDiv.onclick = function () {verifyCode.refresh();}
</script>
</html>

二、XX验证码

三、短信验证码

https://download.csdn.net/download/qq_43542296/89064721

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

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

相关文章

c++11 标准模板(STL)本地化库 - 平面类别 - (std::ctype) 定义字符分类表(三)

本地化库 本地环境设施包含字符分类和字符串校对、数值、货币及日期/时间格式化和分析&#xff0c;以及消息取得的国际化支持。本地环境设置控制流 I/O 、正则表达式库和 C 标准库的其他组件的行为。 平面类别 定义字符分类表 std::ctype template< class CharT > clas…

【nc工具信息传输】

nc&#xff0c;全名叫 netcat&#xff0c;它可以用来完成很多的网络功能&#xff0c;譬如端口扫描、建立TCP/UDP连接&#xff0c;数据传输、网络调试等等&#xff0c;因此&#xff0c;它也常被称为网络工具的 瑞士军刀 。 nc [-46DdhklnrStUuvzC] [-i interval] [-p source_po…

Linux系统Docker搭建Wiki.Js应用程序并结合cpolar实现公网访问内网知识库

文章目录 1. 安装Docker2. 获取Wiki.js镜像3. 本地服务器打开Wiki.js并添加知识库内容4. 实现公网访问Wiki.js5. 固定Wiki.js公网地址 不管是在企业中还是在自己的个人知识整理上&#xff0c;我们都需要通过某种方式来有条理的组织相应的知识架构&#xff0c;那么一个好的知识整…

腾讯云4核8G12M服务器和标准型S5服务器配置价格表

2024年腾讯云4核8G服务器租用优惠价格&#xff1a;轻量应用服务器4核8G12M带宽646元15个月&#xff0c;CVM云服务器S5实例优惠价格1437.24元买一年送3个月&#xff0c;腾讯云4核8G服务器活动页面 txybk.com/go/txy 活动链接打开如下图&#xff1a; 腾讯云4核8G服务器优惠价格 轻…

数据结构和算法:十大排序

排序算法 排序算法用于对一组数据按照特定顺序进行排列。排序算法有着广泛的应用&#xff0c;因为有序数据通常能够被更高效地查找、分析和处理。 排序算法中的数据类型可以是整数、浮点数、字符或字符串等。排序的判断规则可根据需求设定&#xff0c;如数字大小、字符 ASCII…

基于注意力整合的超声图像分割信息在乳腺肿瘤分类中的应用

基于注意力整合的超声图像分割信息在乳腺肿瘤分类中的应用 摘要引言方法 Segmentation information with attention integration for classification of breast tumor in ultrasound image 摘要 乳腺癌是世界范围内女性最常见的癌症之一。基于超声成像的计算机辅助诊断&#x…

prompt 工程案例

目录 prompt 工程是什么&#xff1f; 案例 vllm 推理加速框架 prompt 工程是什么&#xff1f; prompt&#xff1a;提示词&#xff0c;也就是我们使用网页版输入给大模型的内容就叫 prompt&#xff0c;那什么是 prompt 工程呢&#xff1f; 简单理解其实就是利用编写的 prom…

使用自己训练的superpoint与superglue模型进行图像配准

基于官方团队发布的预训练模型&#xff0c;使用SuperPoint与SuperGlue实现图像配准&#xff0c;可以参考https://blog.csdn.net/a486259/article/details/129093084 基于官方团队发布的代码训练自己的模型&#xff0c;可以参考https://blog.csdn.net/a486259/article/details/…

如何理解UDP 和 TCP? 区别? 应用场景?

文章目录 一、UDP二、TCP三、区别参考文献 一、UDP UDP&#xff08;User Datagram Protocol&#xff09;&#xff0c;用户数据包协议&#xff0c;是一个简单的面向数据报的通信协议&#xff0c;即对应用层交下来的报文&#xff0c;不合并&#xff0c;不拆分&#xff0c;只是在…

什么是运放噪声频率曲线?怎么算噪声有效值?只需要3个公式!

原文来自微信公众号&#xff1a;工程师看海&#xff0c;与我联系&#xff1a;chunhou0820 看海原创视频教程&#xff1a;《运放秘籍》 大家好&#xff0c;我是工程师看海&#xff0c;原创文章欢迎点赞分享&#xff01; 运放有哪些噪声源&#xff1f;什么是噪声频率曲线&#x…

使用Autodl与Xftp远程训练模型及管理远程文件

1 AutoDL网站登录创建实例 AutoDL网站:AutoDL算力云 | 弹性、好用、省钱。租GPU就上AutoDL 1&#xff09;进入算力市场&#xff0c;选取可用显卡&#xff08;工作日一般白天抢不到&#xff0c;晚上才能抢到&#xff09; 2&#xff09;选择配置环境 3&#xff09;创建成功实例…

蓝桥集训之阶乘分解

蓝桥集训之阶乘分解 核心思想&#xff1a;线性筛质数 筛出每一个质数后 只要将所有质数的1 2 3 … 次方个数都加上即可 #include <iostream>#include <cstring>#include <algorithm>#include <vector>using namespace std;const int N 1e610;int …

python中如何使用help()

help()函数帮助我们了解模块、类型、对象、方法、属性的详细信息。 1、帮助查看类型详细信息&#xff0c;包含类的创建方式、属性、方法 >>> help(list) Help on class list in module builtins: class list(object)| list() -> new empty list| list(iterable)…

企微知识库优缺点解析:如何让其效益最大化

企业搭建企微知识库&#xff0c;作为企业内部知识的集中存储和共享平台&#xff0c;为企业带来了很多便利。但是&#xff0c;任何事物都有其两面性&#xff0c;企微知识库也不例外。今天我们就来详细探讨搭建企微知识库的优点和缺点&#xff0c;如何在使用企微知识库时使其发挥…

联达动力OA 多处任意文件上传漏洞复现

0x01 产品简介 联达动力OA是PHPOA推出的新一代OA系统,系统支持性好、安全、数据高速缓存化;支持100+应用自行安装与定义,应用表单自定义,支持应用无代码开发,支持多语言。 0x02 漏洞概述 联达动力OA /FileManage/UpLoadFile.aspx、/Hosp_Portal/uploadLogo.aspx、/Dept_Por…

7.stack容器的使用

文章目录 stack容器常用接口代码工程运行结果 stack容器 常用接口 /*1.push - 入栈*/ /*2.top - 查看栈顶元素*/ /*3.pop - 出栈*/代码工程 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<stack>using namespace std;/*1.push - 入栈*/ /*2.top…

Linux-Arm GDB调试(本地和远程)

目录 问题描述 已有coredump 没有coredump 小结 问题描述 Linux本机调试使用GDB非常方便&#xff0c;但嵌入式Linux设备资源有限&#xff0c;通常并没有交叉编译工具&#xff0c;那嵌入式设备上的应用发生问题如何查找问题&#xff1f;通常IDE有远程DEBUG功能&#xff0c;这…

3.冒泡排序

冒泡排序 基本思想&#xff1a;每次比较两个相邻的元素 如果它们的顺序错误就把它们交换过来 重点&#xff1a;交换 时间复杂度为&#xff1a;O(n^2)&#xff08;平均情况、最坏情况&#xff09; 最优情况&#xff1a;输入的数组已经是完全有序的时候 冒泡排序只需要进行一…

IT外包服务:企业数据资产化加速利器

随着数字化时代的兴起&#xff0c;数据成为企业最为重要的资源之一。数据驱动创新对于企业的竞争力和可持续发展至关重要。在这一进程中&#xff0c;IT外包服务发挥着关键作用&#xff0c;加速企业数据资产化进程&#xff0c;为企业提供了重要支持。 首先&#xff0c;IT外包服务…

第七讲 索引并发控制

我们假设迄今为止讨论的所有数据结构都是单线程访问的。 但 DBMS 需要允许多个线程安全地访问数据结构&#xff0c;以充分利用额外的 CPU &#xff0c;并隐藏磁盘 I/O 停顿。 并发控制协议【concurrency control protocol】是 DBMS 用于确保在共享对象上的并发操作得到“正确”…