B050-cms05-轮播图 cookie session 登录

news2024/9/28 11:12:17

目录

      • 轮播图
        • 修改操作
        • 删除操作
        • 查询并展示所有轮播图
      • 无状态的HTTP协议
      • Cookie
        • Cookie的原理
        • Cookie的创建
        • 获取Cookie
        • 更新Cookie
        • 设置cookie的声明周期
        • 设置cookie访问路径
        • Cookie优缺点
      • Session
        • Session原理
        • 创建Session
        • Session的使用
        • sesion的生命周期
        • Session的优缺点
        • Cookie和Session的区别
      • 登录功能实现
        • 登录页面准备
        • 登录请求
        • 登录后台实现
        • 登录页面处理

轮播图

修改操作

如果带图片:上传,修改数据库信息,删除旧图,
如果不带图片:不走上传,直接修改数据库信息,不走删除旧图

SlideServiceImpl

	@Override
	public void save(Slide slide, HttpServletRequest req,MultipartFile photo) throws Exception {
		// 获取upload路径
		String realPath = req.getServletContext().getRealPath("/upload");
		File file = new File(realPath);		
		if(!file.exists()){// 如果路径不存在,就创建一个
			file.mkdirs();
		}		
		// 判断photo是否为空
		if(photo!=null){// 做上传操作	
			// 获取文件名
			//获取后缀
			String oName = photo.getOriginalFilename(); // asldfsadf.jpg
			String suffix = oName.substring(oName.lastIndexOf("."));
			String name = System.currentTimeMillis()+suffix;
			// 准备输入流
			InputStream input = photo.getInputStream();			
			// 输出流
			FileOutputStream output = new FileOutputStream(new File(realPath, name));
			// 上传的核心代码
			IOUtils.copy(input, output);
			
			// 关流
			output.close();
			input.close();
			
			// name path
			slide.setName(name);
			slide.setPath("/upload/"+name);
			
		// 	System.out.println(slide);			
		}
		
		// 添加数据库操作
		if(slide.getId()==null){
			if(photo!=null){
				mapper.add(slide);
			}
		}else{// 修改操作
			// 如果修改了图片,删除之前的图片
			// 根据id查到之前的信息
			Slide dbSlide = mapper.findOne(slide.getId());
			
			// 修改
			mapper.update(slide);			
			if(photo!=null){				
				String name = dbSlide.getName();
				File file2 = new File(realPath, name);
				if(file2.exists()){
					file2.delete();
				}
			}
		}	
	}

SlideMapper

	<!-- Slide findOne(Long id); -->
	<select id="findOne" resultType="slide">
		select * from t_slide where id = #{id}
	</select>

	<!-- void update(Slide slide); 
		判断name和path是否为空,不为空则代表了修改了图片	
	-->
	<update id="update">
		update t_slide set 
		<if test="name != null">
			name = #{name},
		</if>
		<if test="path != null">
			path = #{path},
		</if>
		createDate = #{createDate}, enable = #{enable}
		where id = #{id}
	</update>

删除操作

slide.js

			var delId;
		 	// 删除操作  绑定的是删除按钮
		    $("body").on("click","a[data-id]",function(){
		    	// 获取id
		    	delId = $(this).data("id");
		    	// alert(delId)
		    	// 弹出模态框
		    	$("#delModal").modal("show");
		    });
		 	
		 	// 删除模态框确定按钮  绑定一个事件  发送删除请求
		    $("#delModalButton").click(function(){
		    	
		    	// alert("......");
		    	// 删除请求
		    	$.ajax({
		    		type: "post",
		    		url: "/system/slide/delById",
		    		data: {"id":delId}, // "id="+delId
		    		dataType: "json",
		    		success: function(msg){
		    			if(msg.success){// 成功
		    				// 关闭模态框
		    				$("#delModal").modal("hide");
		    				// 刷新数据 ????
		    				GridManager.refreshGrid("demo-ajaxPageCode", true);
		    			}else{
		    				// 关闭模态框
		    				$("#delModal").modal("hide");
		    				// 失败提示
		    				alert(msg.error)
		    			}
		    		}
		    	});		    	    	
		    });

SlideController

	@RequestMapping("/delById")
	@ResponseBody
	public AjaxResult delById(Long id,HttpServletRequest req){
		try {
			service.delById(id,req);
			return new AjaxResult();
		} catch (Exception e) {
			e.printStackTrace(); // 打印异常信息
			return new AjaxResult(false, "删除失败");
		}
	}

SlideServiceImpl

	@Override
	public void delById(Long id, HttpServletRequest req) {
		//  删除upload中的图片 删除数据库
		// 获取父路径
		String realPath = req.getServletContext().getRealPath("/upload");
		Slide dbSlide = mapper.findOne(id);
		String name = dbSlide.getName();
		File file = new File(realPath, name);
		// 删除upload下面的图片
		if(file.exists()){
			file.delete();
		}		
		// 删除数据库
		mapper.delById(id);
	}

SlideMapper

	<!-- void delById(Long id); -->
	<delete id="delById">
		delete from t_slide where id=#{id}
	</delete>

查询并展示所有轮播图

页面加载发送查询请求,拿到数据后遍历动态拼接展示在对应位置

前台首页index.html

<div class="container swiper-container" id="banner">
			    <div class="swiper-wrapper" id="slidePhoto">
					<!-- <a target="_blank" href=""  class="swiper-slide swiper-lazy" data-background="/static/home/img/index/banner.png"><div class="swiper-lazy-preloader"></div></a> -->
			    </div>
			    <div class="swiper-pagination"></div>
				<script>
					$(function() {
						// 发送请求, 查询所有的图片
						$.ajax({
							type: "post",
							url: "/home/slide/findAll",
							dataType: "json",
							success: function(msg){
								//console.debug(msg);
								$.each(msg,function(){
									$("#slidePhoto").append('<a target="_blank" href=""  class="swiper-slide swiper-lazy" data-background="'+this.path+'"><div class="swiper-lazy-preloader"></div></a>')
								});
								
								// 轮播图效果
								var bannerSwiper = new Swiper ('#banner.swiper-container', {
								 	autoplay: { disableOnInteraction: false },
								    loop: true,
								    pagination: {
								      	el: '.swiper-pagination',
								      	bulletElement: 'div',
								     	clickable: true
								    },
									lazy: true
							  	});
							  	$("#banner .swiper-slide")
								  	.mouseenter(function() {
								  		bannerSwiper.autoplay.stop();
								  	})
								  	.mouseleave(function() {
								  		bannerSwiper.autoplay.start();
								  	});
							}
						})
					});
				</script>
			</div>

HomeController

	/**
	 * @Description:前台首页查询所有的轮播图
	 */
	@RequestMapping("/slide/findAll")
	@ResponseBody
	public List<Slide> findAllHome(){
		
		return slideService.findAllHome();
	}

SlideServiceImpl

	@Override
	public List<Slide> findAllHome() {
		
		return mapper.findAllHome();
	}

SlideMapper

    <!-- List<Slide> findAll();	 -->
	<select id="findAllHome" resultType="slide">
		select * from t_slide
	</select>

无状态的HTTP协议

无状态:前一次请求和后一次请求之间没有关联(数据不可以共享)
会话:客户端与服务端的多次请求和响应的一个过程称之为一次会话,一次会话可以有多次请求。

会话跟踪技术:Cookie,Session,

Cookie

Cookie的原理

在这里插入图片描述

Cookie的创建

CookieController

	@RequestMapping("/add")
	public void addCookie(HttpServletResponse response) throws Exception{
		// 创建cookie
		Cookie c1 = new Cookie("id", "123");  // key和value都是string类型
		Cookie c2 = new Cookie("name", "tom");
		// 编码
		Cookie c3 = new Cookie("address",URLEncoder.encode("湖北武汉","utf-8") ); // cookie的value不能是中文
						
		// 把cookie添加到浏览器端
		response.addCookie(c1);
		response.addCookie(c2);
		response.addCookie(c3);
		
		// 向浏览器端输出success
		response.getWriter().write("success");
	}

第一次访问会在服务器端生成cookie并响应给浏览器
在这里插入图片描述
再次访问其他地址浏览器会在请求头加上cookie
在这里插入图片描述

获取Cookie

CookieController

	@RequestMapping("/get")
	public void getCookies(HttpServletRequest request) throws Exception{
		// 获取cookies
		Cookie[] cookies = request.getCookies();
		for (Cookie cookie : cookies) {
			System.out.println(cookie.getName()); // 获取cookie的key
			// 解码    获取cookie的value
			System.out.println(URLDecoder.decode(cookie.getValue(), "utf-8"));
		}
	}

更新Cookie

第一种:先获取相应的value – 遍历 – 判断 – setValue(String value)
第二种:添加一个相同name值的Cookie,直接覆盖

CookieController

	@RequestMapping("/add")
	public void addCookie(HttpServletResponse response) throws Exception{
		// 创建cookie
		Cookie c1 = new Cookie("id", "123");  // key和value都是string类型
		Cookie c2 = new Cookie("name", "tom");
		// 更新, 覆盖
		Cookie c4 = new Cookie("name", "jack");
		// 编码
		Cookie c3 = new Cookie("address",URLEncoder.encode("湖北武汉","utf-8") ); // cookie的value不能是中文
						
		// 把cookie添加到浏览器端
		response.addCookie(c1);
		response.addCookie(c2);
		response.addCookie(c3);
		response.addCookie(c4);
		
		// 向浏览器端输出success
		response.getWriter().write("success");
	}

设置cookie的声明周期

生命周期:指的是Cookie中的数据能保存多久
默认请求下:浏览器会将Cookie保存在内存中,只要浏览器不关闭,数据都在。直到浏览器关闭,数据消失
如果设置了setMaxAge(int n),
n<0:默认状态,保存在内存中,关闭浏览器数据失效
n=0:立即删除
n>0:保存在硬盘中,持续n秒(这时跟浏览器关不关闭无关,直到时间走完之后自动删除
例子:c1.setMaxAge(30);//设置c1的声明周期为30s

	@RequestMapping("/add")
	public void addCookie(HttpServletResponse response) throws Exception{
		// 创建cookie
		Cookie c1 = new Cookie("id", "123");  // key和value都是string类型
		Cookie c2 = new Cookie("name", "tom");
		// 更新, 覆盖
		Cookie c4 = new Cookie("name", "jack");
		// 编码
		Cookie c3 = new Cookie("address",URLEncoder.encode("湖北武汉","utf-8") ); // cookie的value不能是中文
					
		// 设置存活时间   要在添加到浏览器之前设置
		c1.setMaxAge(0); // 立即删除
		c3.setMaxAge(10); // 存活时间是10秒
		
		// 把cookie添加到浏览器端
		response.addCookie(c1);
		response.addCookie(c2);
		response.addCookie(c3);
		response.addCookie(c4);
		
		// 向浏览器端输出success
		response.getWriter().write("success");
	}

设置cookie访问路径

Cookie不能跨路径获取,用c1.setPath(“/”);//设置/跟路径有效,解决跨路径问题

	@RequestMapping("/add")
	public void addCookie(HttpServletResponse response) throws Exception{
		// 创建cookie
		Cookie c1 = new Cookie("id", "123");  // key和value都是string类型
		Cookie c2 = new Cookie("name", "tom");
		// 更新, 覆盖
		Cookie c4 = new Cookie("name", "jack");
		// 编码
		Cookie c3 = new Cookie("address",URLEncoder.encode("湖北武汉","utf-8") ); // cookie的value不能是中文
					
		// 设置存活时间   要在添加到浏览器之前设置
		c1.setMaxAge(0); // 立即删除
		c3.setMaxAge(10); // 存活时间是10秒
		
		// 设置cookie的跨路径
		c4.setPath("/");
		
		// 把cookie添加到浏览器端
		response.addCookie(c1);
		response.addCookie(c2);
		response.addCookie(c3);
		response.addCookie(c4);
		
		// 向浏览器端输出success
		response.getWriter().write("success");
	}

Cookie优缺点

优点:减轻了服务器的压力

缺点:1.数据保存在浏览中,数据容易丢失,数据容易被获取,不安全。Cookie可以被禁用
   2.保存数据类型有限,只能是字符串
   3.保存的数据大小有限制,大约是4kb左右

Session

Session原理

在这里插入图片描述
在这里插入图片描述

创建Session

自动创建:直接访问JSP
手动创建:req.getSession(),SpringMvc中可以直接参数获取

SessionController

	@RequestMapping("/create")
	public String createSession( HttpServletRequest request,HttpSession session){
		// 创建session  没有session就创建一个,如果有session,获取session
	//	HttpSession session1 = request.getSession();
	//	HttpSession session2 = request.getSession();
		
	// 	System.out.println(session2==session1);
		// 设置数据
		session.setAttribute("name", "王天霸");
		session.setAttribute("age", 20);
		// 重定向  
		return "redirect:/session.jsp";
	}

Session的使用

绑定数据:setAttribute(String name,String value)
获取数据:getAttribute(String name)
移除数据:removeAttribute(String name)

sesion的生命周期

sesion的生命周期
1.出生:创建Session对象;
2.invalidate():销毁session对象

数据保存的时间
出生:添加数据的时候
数据消失:过期时间结束;
默认的过期时间是30分钟,如果没有自定义的web.xml,默认就在tomcat/conf/web.xml里;从不操作开始计时

自定义:
代码方式:session.setMaxInactiveInterval(int s),不建议使用
web.xml方式:< session-config >,单位是分钟

Session的优缺点

优点:由于session是将数据保存在服务器端,安全性高相对较高
   大小相对于Cookie来说大得多
   数据类型没有限制

缺点:可能会影响服务器的性能

Cookie和Session的区别

Cookie:数据保持在浏览器端,不安全,大小有限制 ,类型有限制,但是服务器压力小
Session:数据保持在服务器端,安全,大小无限制 ,类型无限制,但是会影响服务器性能

登录功能实现

登录页面准备

准备前台页面 login.jsp
注意:要重新引入头部和尾部静态资源

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
     <%@include file="/WEB-INF/views/common/topStatic.jsp" %>
    <title>CMS登陆</title>
  </head>
  <body>
    <section class="material-half-bg">
      <div class="cover"></div>
    </section>
    <section class="login-content">
      <div class="logo">
        <h1>cms后台登陆</h1>
      </div>
      <div class="login-box">
        <form class="login-form" method="post" action="/system/login">
          <h3 class="login-head"><i class="fa fa-lg fa-fw fa-user"></i>登陆</h3>
          <div class="form-group">
            <label class="control-label">用户名</label>
            <input class="form-control" type="text"  name="username" placeholder="用户名" autofocus>
          </div>
          <div class="form-group">
            <label class="control-label">密码</label>
            <input class="form-control" type="password" name="password" placeholder="密码">
          </div>
          <div class="form-group">
            <div class="utility">
              <div class="animated-checkbox">
                <label>
                  <input type="checkbox"><span class="label-text">记住我</span>
                </label>
              </div>
            </div>
          </div>
          <div class="form-group btn-container">
            <button class="btn btn-primary btn-block"><i class="fa fa-sign-in fa-lg fa-fw"></i>登陆</button>
          </div>
        </form>
      </div>
    </section>
     <%@include file="/WEB-INF/views/common/buttomStatic.jsp" %>
  </body>
</html>

后台UserController做跳转登录页面

@Controller
@RequestMapping("/system")
public class UserController {
	
	@RequestMapping("/login")
	public String goLogin(){
		return "login";
	}
}

登录请求

页面设置登录按钮id

          <div class="form-group btn-container">
            <button id="loginBtn" class="btn btn-primary btn-block"><i class="fa fa-sign-in fa-lg fa-fw"></i>登陆</button>
          </div>

加载发送请求

	<script type="text/javascript">
     	$(function(){
     		$("#loginBtn").click(function(){
     			$(".login-form").ajaxSubmit({
     				success: function(msg){
     					console.debug(msg);
     				}
     			});
     		});
     	})
     </script>

后台依次处理
UserController

	@RequestMapping(value="/login",method=RequestMethod.POST)
	@ResponseBody
	public AjaxResult login(String username,String password){
		
		try {
			service.login(username,password);
			return new AjaxResult();
		} catch (Exception e) {
			// 从exception中取错误信息
			return new AjaxResult(false, e.getMessage());
		}
	}

登录后台实现

UserController

	@RequestMapping(value="/login",method=RequestMethod.POST)
	@ResponseBody
	public AjaxResult login(String username,String password,HttpSession session){
		
		try {
			User user = service.login(username,password);
			// 把用户信息放入session中
			session.setAttribute("USER_IN_SESSION", user);
			return new AjaxResult();
		} catch (Exception e) {
			// 从exception中取错误信息
			return new AjaxResult(false, e.getMessage());
		}
	}

UserServiceImpl

	@Override
	public User login(String username, String password) throws Exception {
		// 1.通过名称去数据库查询信息,user对象
		User user = mapper.findUserByName(username);
		// 判断user是否为null
		if(user==null){
			throw new Exception("用户名不存在");
		}else{// 用户存在 ,判断密码是否相同
			if(!user.getPassword().equals(password)){
				throw new Exception("密码错误");
			}else{// 登录成功
				return user;
			}
		}
	}

UserMapper

	<!-- User findUserByName(String username); -->
	<select id="findUserByName" resultType="user">
		select * from t_user where username=#{username}
	</select>

登录页面处理

tips:

          <!-- type="button" type的值不指定就默认是submit走同步请求不走异步请求 -->
		  <div class="form-group btn-container">
            <button type="button" id="loginBtn" class="btn btn-primary btn-block"><i class="fa fa-sign-in fa-lg fa-fw"></i>登陆</button>
          </div>

login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
     <%@include file="/WEB-INF/views/common/topStatic.jsp" %>
    <title>CMS登陆</title>
  </head>
  <body>
    <section class="material-half-bg">
      <div class="cover"></div>
    </section>
    <section class="login-content">
      <div class="logo">
        <h1>cms后台登陆</h1>
      </div>
      <div class="login-box">
        <form class="login-form" method="post" action="/system/login">
          <h3 class="login-head"><i class="fa fa-lg fa-fw fa-user"></i>登陆<span id="loginError"></span></h3>
          <div class="form-group">
            <label class="control-label">用户名</label>
            <input class="form-control" type="text"  name="username" placeholder="用户名" autofocus>
          </div>
          <div class="form-group">
            <label class="control-label">密码</label>
            <input class="form-control" type="password" name="password" placeholder="密码">
          </div>
          <div class="form-group">
            <div class="utility">
              <div class="animated-checkbox">
                <label>
                  <input type="checkbox"><span class="label-text">记住我</span>
                </label>
              </div>
            </div>
          </div>
          <div class="form-group btn-container">
            <button type="button" id="loginBtn" class="btn btn-primary btn-block"><i class="fa fa-sign-in fa-lg fa-fw"></i>登陆</button>
          </div>
        </form>
      </div>
    </section>
     <%@include file="/WEB-INF/views/common/buttomStatic.jsp" %>
     
     <script type="text/javascript">
     	$(function(){
     		$("#loginBtn").click(function(){
     			$(".login-form").ajaxSubmit({
     				success: function(msg){
     					if(msg.success){// 成功
     						// 跳转到后台首页
     						location.href="/system/index";
     					}else{
     						$("#loginError").html("<font color='red' size='4'>"+msg.error+"</font>");
     					}
     				}
     			});
     		});
     	})
     </script>
  </body>
</html>

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

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

相关文章

定积分计算—牛顿-莱布尼兹公式、定积分的几何意义、利用奇偶性化简、利用Wallis公式

定积分计算 前言定积分的常规计算技巧—牛顿-莱布尼茨公式定积分的几何意义利用奇偶性简化计算![在这里插入图片描述](https://img-blog.csdnimg.cn/9acfec48362141ba9486630f7060d78d.jpg)利用周期性平移和缩小积分区间利用Wallis公式利用一个常见的积分公式定积分计算练习题 …

yolov8 -01 部署

本想去配环境的步骤&#xff0c;在之前yolov5运行的环境下&#xff0c;试predict yolov8&#xff0c;竟然报错。 与其改bug, 选择重头来。 1. conda 创建新环境 yolo 8 conda create -n yolo82. 官网下载资料 官网下载yolo8相关资料 https://github.com/ultralytics/ultraly…

Flutter 检查连接网络 connectivity_plus

Flutter 检查连接网络 connectivity_plus 前言 有些对通讯敏感的程序&#xff0c;我们需要检查当前连接的网络情况。 我推荐使用 connectivity_plus https://pub-web.flutter-io.cn/packages/connectivity_plus 这个插件的好处就是支持全平台&#xff0c;这点非常好。 我们今天…

socketio连接失败,nginx返回502 connect() failed (111: Connection refused)

现象 我们信控平台&#xff0c;需要实时展示信号灯灯态&#xff08;红黄绿、倒计时等&#xff09; 当灯态变化时&#xff0c;前端信号机设备会通过socket协议将消息推送给我们的通信服务&#xff0c;通信服务将消息解析处理后&#xff0c;关联路口信息&#xff0c;再把信息通过…

数据库监控与调优【四】—— EXPLAIN详解

EXPLAIN详解&#xff08;使用、可视化、扩展与性能计算公式&#xff09; TIPS 本文基于MySQL 8.0编写&#xff0c;理论支持MySQL 5.0及更高版本。 什么是EXPLAIN命令 EXPLAIN命令是查看MySQL查询优化器如何执行查询的主要方法&#xff0c;可以很好地分析SQL语句的执行情况。每…

MPLS新手排查丢包问题

借助查问题又重新复习了一下mpls协议&#xff0c;首先复习一下它的报文格式&#xff1a; 0---------------19-------22---23------------31 | Label value | Exp | Bos | TTL | -----------------|---------|-------|-------------| 字段意义&#xff1a; Label v…

全网最新超详细的【Axure】Axure RP 10的下载、安装、中文字体、授权【2023年】

文章目录 1. 文章引言2. 下载Axure103. 安装Axure104. Axure10中文5. 解决axure弹框更新的问题6. 重要备注7. Axure10授权 1. 文章引言 最近在学习原型图&#xff0c;针对画原型图的工具&#xff0c;反复对比墨刀、Axure、xiaopiu后&#xff0c;最终选择了Axure。 接下来&…

ansible自动化IT工具安装部署与使用验证

目录 一、环境配置 1、关闭防火墙 2、免密登录配置 3、同步时区 二、服务端配置 1、安装软件 2、查看版本 3、实现远程控制huyang3 4、测试 结果验证&#xff1a; 一、环境配置 1、关闭防火墙 systemctl stop firewalld iptables -F setenforce0 2、免密登录配置 【huy…

二叉树题目:二叉树展开为链表

文章目录 题目标题和出处难度题目描述要求示例数据范围进阶 解法一思路和算法代码复杂度分析 解法二思路和算法代码复杂度分析 解法三思路和算法代码复杂度分析 后记 题目 标题和出处 标题&#xff1a;二叉树展开为链表 出处&#xff1a;114. 二叉树展开为链表 难度 3 级 …

8 从0开始学PyTorch | PyTorch中自动计算梯度、使用优化器

上一节&#xff0c;我们写了很多代码&#xff0c;但是不知道你有没有注意&#xff0c;那些代码看起来跟PyTorch关系并不是很大啊&#xff0c;貌似很多都是Python原生代码&#xff1f; 如果你是这样的感觉&#xff0c;那我要告诉你&#xff0c;你感觉的没有错。前面主要在于机制…

下面告诉你音频转换工具有哪些

今天我想和大家聊一聊音频转换工具。你是不是有时候想把一首酷炫的歌曲转换成你喜欢的音频格式&#xff0c;或者想把录音文件转成可编辑的格式&#xff1f;别担心&#xff0c;这里有一些超赞的音频转换工具&#xff0c;可以帮你解决这些问题&#xff01;无论是从MP3到WAV&#…

武汉大学计算机考研分析

关注我们的微信公众号 姚哥计算机考研 更多详情欢迎咨询 武汉大学&#xff08;A-&#xff09;考研难度&#xff08;☆☆☆☆☆&#xff09; 武汉大学计算机考研招生学院是计算机学院、国家网络安全学院和测绘遥感信息工程国家重点实验室。目前均已出拟录取名单。 武汉大学计…

Redis的3大特殊数据类型(1)-BitMap

BitMap(位图/位数组)是Redis2.2.0版本中引入的一种新数据类型&#xff0c;该数据类型本质是一个仅含0和1的二进制字符串。因此可以把 Bitmap 想象成一个以位为单位的数组&#xff0c;数组的每个单元只能存储 0 和 1&#xff0c;数组的下标在 Bitmap 中叫做偏移量 offset&#x…

volatile关键字和ThreadLocal

作用&#xff1a; 1.线程的可见性&#xff1a;当一个线程修改一个共享变量时&#xff0c;另外一个线程能读到这个修改的值。 2. 顺序一致性&#xff1a;禁止指令重排序。 线程之间的共享变量存储在主内存中&#xff08;Main Memory&#xff09;中&#xff0c;每个线程都一个都…

StarRocks Friends 上海站活动回顾(含 PPT 下载链接)

6月17日&#xff0c; StarRocks & Friends 上海站活动如期而至&#xff0c;近百位社区小伙伴参与交流活动&#xff1b;针对 StarRocks 存算分离、StarRocks 在业界的应用实践、以及 StarRocks 与 BI 结合、湖仓一体规划等话题展开激烈的交流互动。 本文总结了技术交流活动…

未来的彩电,彩电的未来

疫情后的首个线上大促已经结束&#xff0c;“史上投入最大618”也没能抵住彩电市场整体的需求疲软。 根据奥维云网线上推总数据&#xff0c;2023年618期间&#xff0c;中国彩电线上市场零售量规模为249.9万台&#xff0c;同比下降12.9%&#xff1b;零售额规模为79.7亿元&#…

配电柜(箱)使用防雷浪涌保护器的作用和方案

配电箱是电力系统中的重要组成部分&#xff0c;负责将电力从供电系统输送到各个电器设备。然而&#xff0c;由于天气状况和其他因素的影响&#xff0c;电力系统可能会受到雷击引起的浪涌电压的威胁。为了保护配电箱和其中的设备免受浪涌电压的破坏&#xff0c;我们需要在配电箱…

Redis中3大特殊数据结构(2)-HyperLogLog

HyperLogLog算法是法国人Philippe Flajolet 教授发明的一种基数计数概率算法&#xff0c;每个 HyperLogLog 键只需要花费 12 KB 内存&#xff0c;就可以计算接近 2^64 个不同元素的基数。HyperLogLog 适用于大数据量的去重统计&#xff0c;HyperLogLog 提供不精确的去重计数方案…

基于Java+Swing实现餐厅点餐系统

基于JavaSwing实现餐厅点餐系统 一、系统介绍二、系统展示1.主页2.点菜3.下单4.结算5.销售情况&#xff08;管理员&#xff09; 三、系统实现四、其他系统五、获取源码 一、系统介绍 该系统针对两个方面的用户&#xff0c;一个是用餐客户&#xff0c;另一个是餐厅管理员。将功…

iOS 17 beta 2有哪些BUG?iOS 17 beta 2推荐升级吗?

虽然iOS 17 beta 2 带来了大量的功能更新&#xff0c;但毕竟是测试版&#xff0c;海量的适配BUG也一同随之而来。 想升级iOS 17 beta 2的用户不妨先查看下目前存在的问题汇总&#xff01; 一&#xff1a;存储空间更小了 升级beta1后存储空间缩小了大概3G左右&#xff0c;bet…