大项目之网上书城(八)——数据库大改添加图书

目录

  • 大项目之网上书城(八)——数据库大改&添加图书
    • 主要改动
    • 1.数据库新增表
      • 代码
    • 2.数据库新增触发器
    • 3.其他对BookService和BookDao的修改
      • 代码
    • 4.addBook.jsp
      • 代码
      • 效果图
    • 5.AddNewBookServlet
      • 代码

大项目之网上书城(八)——数据库大改&添加图书

主要改动

今天也是各种各种各种出错的一天啊,经历了各种方法的重写,各种触发器的重写。

那么book表一分为n,多个子表更新数据的时候会联动book表更新数据。然后顺势写了个增加图书的方法。内容不多,错误不少、

1.数据库新增表

代码

以clothing为例,为各个类都新增了一个表。

DROP TABLE IF EXISTS `clothing`;
CREATE TABLE `clothing` (`book_name` varchar(40) NOT NULL,`price` double NOT NULL,`describtion` varchar(200) DEFAULT NULL,`clazz` varchar(40) NOT NULL,`second_id` int(11) NOT NULL AUTO_INCREMENT,`book_img` blob,`click_num` int(11) NOT NULL,`buy_num` int(9) NOT NULL,`re_du` int(12) DEFAULT NULL,`count` int(6) NOT NULL,`is_new` int(1) NOT NULL,`insert_date` date NOT NULL,`book_id` int(11) DEFAULT NULL,PRIMARY KEY (`second_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

2.数据库新增触发器

还是以clothing表为例,两个方法,一个是当子表插入数据时,book表插入一条同样的数据,2是子表更新时,book也做出相应更新。

DROP TRIGGER IF EXISTS `c_insert`;
DELIMITER ;;
CREATE TRIGGER `c_insert` AFTER INSERT ON `clothing` FOR EACH ROW begininsert into book(book_name,price,describtion,clazz,second_id,click_num,buy_num,count,is_new,insert_date) values(NEW.book_name,NEW.price,NEW.describtion,NEW.clazz,NEW.second_id,0,0,NEW.count,1,NEW.insert_date);
end
;;
DELIMITER ;
DROP TRIGGER IF EXISTS `c_update`;
DELIMITER ;;
CREATE TRIGGER `c_update` AFTER UPDATE ON `clothing` FOR EACH ROW beginupdate book set book.re_du = NEW.click_num + NEW.buy_num * 100,book.click_num = NEW.click_num,book.buy_num = NEW.buy_num where clazz = new.clazz and second_id = new.second_id;
end
;;
DELIMITER ;

3.其他对BookService和BookDao的修改

代码

因为改得代码太多,太乱了,不好发,于是重新都发一下实现类好了。

daoimpl

package cn.edu.bdu.mc.daos.impls;import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;import javax.sql.DataSource;import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;import cn.edu.bdu.mc.beans.Book;
import cn.edu.bdu.mc.daos.BookDao;
import cn.edu.bdu.mc.utils.JDBCUtil;public class BookDaoImpl implements BookDao {private DataSource dataSource = JDBCUtil.getDataSource();private QueryRunner queryRunner = new QueryRunner(dataSource);      @Overridepublic Book findNewBookByPaiMing(int shu) throws SQLException {// TODO Auto-generated method stubString sql = "select * from (select * from book where is_new = 1 order by re_du desc)as book1 limit "+(shu-1)+",1";return queryRunner.query(sql, new BeanHandler<Book>(Book.class));}@Overridepublic List<Book> findBookReMen(int page) throws SQLException {String sql = "select * from (select * from book order by re_du desc)as book1 limit "+(page-1)*2+",2";return queryRunner.query(sql, new BeanListHandler<Book>(Book.class));}@Overridepublic void insert(Book book) throws SQLException {// TODO Auto-generated method stubString sql = "insert into "+book.getClazz()+"(book_name,price,describtion,clazz,click_num,buy_num,count,is_new,insert_date) values(?,?,?,?,0,0,?,1,?)";queryRunner.update(sql,book.getBook_name(),book.getPrice(),book.getDescribtion(),book.getClazz(),book.getCount(),new Date());}@Overridepublic Book findBookById(int book_id) throws SQLException{String sql = "select * from book where book_id = ?";return queryRunner.query(sql, new BeanHandler<Book>(Book.class),book_id);}@Overridepublic List<Book>findAllBook() throws SQLException {String sql = "select * from book";return queryRunner.query(sql, new BeanListHandler<Book>(Book.class));}@Overridepublic void deleteById(int book_id) throws SQLException {String sql = "delete from book where book_id = ?";queryRunner.update(sql,book_id);}@Overridepublic void update(Book book) throws SQLException {String sql = "update book set book_name = ?, price = ?, describtion = ?, clazz = ?, second_id = ?, click_num = ?, buy_num = ?, count = ?, is_new = ? where book_id = ?";queryRunner.update(sql,book.getBook_name(),book.getPrice(),book.getDescribtion(),book.getClazz(),book.getSecond_id(),book.getClick_num(),book.getBuy_num(),book.getCount(),book.getIs_new(),book.getBook_id());}@Overridepublic void addImgByName(String book_name, String path) throws SQLException, IOException {// TODO Auto-generated method stubConnection conn = null;PreparedStatement ps = null;FileInputStream in = null;in = new FileInputStream(new File(path));conn = JDBCUtil.getConn();String sql = "update book set book_img = ? where book_name = ?";ps = conn.prepareStatement(sql);ps.setBinaryStream(1, in, in.available());ps.setString(2, book_name);int count = ps.executeUpdate();if (count > 0) {System.out.println("插入成功!");} else {System.out.println("插入失败!");}JDBCUtil.release(conn, ps);}@Overridepublic InputStream getImgById(int book_id) throws SQLException {// TODO Auto-generated method stubConnection conn = null;PreparedStatement ps = null;ResultSet rs = null;InputStream in = null;try {conn = JDBCUtil.getConn();String sql = "select book_img from book where book_id = ?";ps = conn.prepareStatement(sql);ps.setInt(1, book_id);rs = ps.executeQuery();while (rs.next()) {in = rs.getBinaryStream("book_img");}} catch (Exception e) {e.printStackTrace();}JDBCUtil.release(conn, ps, rs);return in;}@Overridepublic Book findBookByClazzAndEr_id(String clazz, int er_id) throws SQLException {// TODO Auto-generated method stubString sql = "select * from "+clazz+" where second_id = ?";Book book = queryRunner.query(sql, new BeanHandler<Book>(Book.class),er_id);if(book.getBook_id()==0) {sql = "select * from book where clazz = ? and second_id = ?";book.setBook_id(queryRunner.query(sql,new BeanHandler<Book>(Book.class),clazz,er_id).getBook_id());sql = "update "+clazz+" set book_id = ?";queryRunner.update(sql,book.getBook_id());}return book;}@Overridepublic void updateClazz(Book book) throws SQLException {// TODO Auto-generated method stubString sql = "update "+book.getClazz()+" set book_name = ?, price = ?, describtion = ?, clazz = ?, book_id = ?, click_num = ?, buy_num = ?, count = ?, is_new = ? where second_id = ?";queryRunner.update(sql,book.getBook_name(),book.getPrice(),book.getDescribtion(),book.getClazz(),book.getBook_id(),book.getClick_num(),book.getBuy_num(),book.getCount(),book.getIs_new(),book.getSecond_id());}}

serviceimpl

package cn.edu.bdu.mc.services.impls;import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;import javax.sql.DataSource;import cn.edu.bdu.mc.beans.Book;
import cn.edu.bdu.mc.daos.BookDao;
import cn.edu.bdu.mc.daos.impls.BookDaoImpl;
import cn.edu.bdu.mc.services.BookService;
import cn.edu.bdu.mc.utils.JDBCUtil;public class BookServiceImpl implements BookService {private DataSource dataSource = JDBCUtil.getDataSource();private BookDao dao = new BookDaoImpl(); @Overridepublic Book findNewBookByPaiMing(int shu) throws SQLException {// TODO Auto-generated method stubreturn dao.findNewBookByPaiMing(shu);}@Overridepublic void click(int book_id) throws SQLException {// TODO Auto-generated method stubBook book = dao.findBookById(book_id);book.setClick_num(book.getClick_num()+1);dao.update(book);dao.updateClazz(book);}@Overridepublic void buy(int book_id) throws SQLException {// TODO Auto-generated method stubBook book = dao.findBookById(book_id);book.setBuy_num(book.getBuy_num()+1);dao.update(book);}@Overridepublic List<Book> findBookReMen(int page) throws SQLException {return dao.findBookReMen(page); }@Overridepublic void addImgByName(String book_name, String path) throws SQLException, IOException {// TODO Auto-generated method stubdao.addImgByName(book_name, path);}@Overridepublic InputStream getImgById(int book_id) throws SQLException {// TODO Auto-generated method stubreturn dao.getImgById(book_id);}@Overridepublic Book findBookByClazzAndEr_id(String clazz, int er_id) throws SQLException {// TODO Auto-generated method stubreturn dao.findBookByClazzAndEr_id(clazz, er_id);}@Overridepublic List<Book> findBookByClazz(String clazz) throws SQLException {List<Book> list = dao.findAllBook();List<Book> newList = new ArrayList<>();//lambda表达式,emmmm,的确可读性不太好的样子。list.forEach(book->{if(book.getClazz().equals(clazz)){newList.add(book);}});/*相当于for (Book book : newList) {if(book.getClazz().equals(clazz)){newList.add(book);}}*/return newList;}@Overridepublic void insert(String book_name, double price, String describtion, String clazz, int count)throws SQLException {// TODO Auto-generated method stubBook book = new Book(book_name,price,describtion,clazz,count);dao.insert(book);}}

4.addBook.jsp

代码

<%@ page language="java" contentType="text/html; charset=utf-8"pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<title>添加图书</title>
</head>
<body style="background-color:#bbb;width:1400px;margin:0 auto">
<!-- 调用头部页面 -->
<div style="width:100%;height:100px;float:left">
<jsp:include page="/admin/head.jsp"></jsp:include>
</div>
<!-- 通用内容体大小 -->
<div style="width:70%;height:600px;float:left;margin-left:15%;"><!-- 好看的图 --><div style="width:55%;height:100%;float:left;margin-top:10%;"><img alt="拿书男孩" src="${pageContext.request.contextPath }/client/img/admin.jpg" style="width:90%;"></div><!-- 登录界面 --><div style="width:45%;height:80%;float:left;margin-top:7%"><form action="${pageContext.request.contextPath }/AddNewBook" method="post"enctype="multipart/form-data" class="form-horizontal" role="form"><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">书名</label><div class="col-sm-9"><input type="text" name="book_name" class="form-control input-lg"placeholder="请输入书名" style="float:left"/></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">价格</label><div class="col-sm-9"><input type="text" name="price" class="form-control input-lg"placeholder="请输入价格" style="float:left"/></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">描述</label><div class="col-sm-9"><textarea class="form-control input-lg" name="describtion" rows="2"placeholder="请输入描述" style="float:left"></textarea></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">类别</label><div class="col-sm-9"><select name="clazz" class="form-control input-lg" style="float:left"><option value="clothing">服装</option><option value="food">食品</option><option value="net_literature">网络文学</option><option value="nursery">育婴童</option><option value="pai">好书拍卖</option><option value="residence">家居</option><option value="sport">运动户外</option></select></div></div><div class="form-group"><label for="lastname" class="col-sm-3 control-label input-lg">数量</label><div class="col-sm-9"><input type="text" name="count" class="form-control input-lg"placeholder="请输入数量" style="float:left"/></div></div><div class="form-group"><label for="exampleInputFile" class="col-sm-3 control-label input-lg" style="float:left;">图片</label><div class="col-sm-9"><input type="file" name="img" class="form-control input-lg" style="float:left"></div></div><div class="form-group"><label for="firstname" class="col-sm-1 control-label input-lg"></label><div class="col-sm-5"><input type="submit" name="submit" value="提交"class="form-control input-lg btn btn-primary"style="width:100%;float:left"/></div><div class="col-sm-5"><input type="reset" name="reset" value="重置" id="re"class="form-control input-lg btn btn-warning"style="width:100%;float:left"/></div></div></form></div></div>
<!-- 调用底部页面 -->
<div style="width:100%;height:60px;float:left">
<jsp:include page="/admin/foot.jsp"></jsp:include>
</div>
</body>
</html>

效果图

1513080-20190621235418489-1788307391.png

5.AddNewBookServlet

代码

package cn.edu.bdu.mc.servlets;import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;
import java.util.UUID;import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;import cn.edu.bdu.mc.services.BookService;
import cn.edu.bdu.mc.services.impls.BookServiceImpl;/*** Servlet implementation class AddNewBookServlet*/
@WebServlet("/AddNewBook")
public class AddNewBookServlet extends HttpServlet {private static final long serialVersionUID = 1L;/*** @see HttpServlet#HttpServlet()*/public AddNewBookServlet() {super();// TODO Auto-generated constructor stub}/*** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)*/protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {BookService bookService = new BookServiceImpl();
//      String book_name = request.getParameter("book_name");
//      String price = request.getParameter("price");
//      String describtion = request.getParameter("describtion");
//      String clazz = request.getParameter("clazz");
//      String count = request.getParameter("count");
//      //测试成功
//      response.getWriter().write(book_name+"<br>"+price+"<br>"+describtion+"<br>"+clazz+"<br>"+count);//把enctype="multipart/form-data"之后好像不能用普通方法获取了。。DiskFileItemFactory factory = new DiskFileItemFactory();File file = new File("d:\\Target");if(!file.exists()) {file.mkdirs();}factory.setRepository(file);ServletFileUpload fileUpload = new ServletFileUpload(factory);fileUpload.setHeaderEncoding("utf-8");try {List<FileItem> fileItems = fileUpload.parseRequest(request);String value = null;String book_name = fileItems.get(0).getString("utf-8");Double price = Double.parseDouble(fileItems.get(1).getString("utf-8"));String describtion = fileItems.get(2).getString("utf-8");String clazz = fileItems.get(3).getString("utf-8");int count = Integer.parseInt(fileItems.get(4).getString("utf-8"));for (FileItem fileItem : fileItems) {if(!fileItem.isFormField()) {String filename = fileItem.getName();filename = filename.substring(filename.lastIndexOf("\\")+1);filename = UUID.randomUUID().toString()+"_"+value+"_"+filename;String webPath = "/upload/";String filepath = getServletContext().getRealPath(webPath+filename);File file2 = new File(filepath);File file3 = new File("d:\\upload\\"+filename);file3.getParentFile().mkdirs();file3.createNewFile();file2.getParentFile().mkdirs();file2.createNewFile();InputStream inputStream = fileItem.getInputStream();OutputStream outputStream = new FileOutputStream(file2);OutputStream outputStream2 = new FileOutputStream(file3);byte[] buffer = new byte[2048];int len;while((len = inputStream.read(buffer)) > 0) {outputStream.write(buffer, 0, len);outputStream2.write(buffer, 0, len);}inputStream.close();outputStream.close();outputStream2.close();fileItem.delete();try {bookService.insert(book_name, price, describtion, clazz, count);String path = "d:/upload/"+filename;bookService.addImgByName(book_name, path);String htmlCode="<!DOCTYPE html>\n" + "<html>"+ "<head>"+ "<link rel=\"stylesheet\" href=\""+request.getContextPath()+"/bootstrap-3.3.7-dist/css/bootstrap.min.css\">"+ "</head>"+ "<body>"+ "<div style=\"position:absolute;left:44%;top:46%;height:100px;width:240px;background-color:rgba(145, 162, 196, 0.9);border:1px;text-align:center;\"id=\"quit1\">\r\n" + "   <h3>添加成功!</h3><a class=\"btn btn-info\" href=\""+request.getContextPath()+"/admin/addBook.jsp\">继续添加</a>&nbsp;&nbsp;&nbsp;&nbsp;"+"<a class=\"btn btn-info\" href=\""+request.getContextPath()+"/client/index.jsp\">去主页</a>\n" + "</div>"+ "</body>"+ "</html>";response.getWriter().write(htmlCode);} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}} catch (FileUploadException e) {// TODO Auto-generated catch blocke.printStackTrace();}}/*** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)*/protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stubdoGet(request, response);}}

转载于:https://www.cnblogs.com/zhangA/p/11067356.html

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

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

相关文章

hping3工具DOS攻击实验

需要两台机器&#xff0c;一台扮演攻击源&#xff0c;另一做目标源。 攻击源地址:10.0.40.4 被攻击机器地址:10.0.40.246 2 被攻击的机器上安装tcpdump&#xff0c;tcpdump主要是用来抓包的&#xff0c;看看网络数据包是否到达。 $ yum install tcpdump -y 3 首先开启tcp…

腾讯T2亲自讲解!搞懂开源框架设计思想真的这么重要吗?系列篇

Java相关 无论什么级别的Android从业者&#xff0c;Java作为Android开发基础语言。不管是工作还是面试中&#xff0c;Java都是必考题。如果不懂Java的话&#xff0c;薪酬会非常吃亏&#xff08;美团尤为重视Java基础&#xff09; 详细介绍了Java泛型、注解、并发编程、数据传…

阿里P7亲自教你!我的头条面试经历分享,完整PDF

前言 转眼间&#xff0c;2020 年已过去一大半了&#xff0c;2020 年很难&#xff0c;各企业裁员的消息蛮多的&#xff0c;降职&#xff0c;不发年终奖等等。2020 年确实是艰难的一年。然而生活总是要继续&#xff0c;时间不给你丧的机会&#xff01;如果我们能坚持下来&#x…

Java多线程 ——线程基础和锁锁锁

Java多线程(一) 一、线程的定义二、Synchronize线程同步三、偏向锁、自旋锁、重量级锁四、volatile关键字 4.1.普通变量运算的物理意义4.2.有无解决的方案4.3.volatile的几个特性&#xff08;参考https://www.cnblogs.com/kubidemanong/p/9505944.html&#xff09;五、Compare …

阿里P7级别面试经验总结,进阶学习资料!

一、前言 本人面试已经很久之前了&#xff0c;分享一下我做美团面试官的经历吧。 美团上海面试&#xff0c;2-1及以下美团是不社招的&#xff0c;校招和2-2~2-3社招一般是三面&#xff0c;格外优秀3-1及以上会加签面试。初面技术基础&#xff0c;二面业务感知和技术项目&#…

阿里P8大牛亲自教你!史上最全的Android面试题集锦,这原因我服了

一、架构师专题 想要掌握复杂的技术&#xff0c;必须要理解其原理和架构。本模块结合实际一线互联网大型项目理解架构思维&#xff0c;抽丝剥茧&#xff0c;层层深入&#xff0c;帮助大家成为Android架构师&#xff0c;在思想上对架构认识有一次升华&#xff0c;并知其所以然&a…

面向对象程序设计——UML分析和本学期总结

​ 随着第四单元UML第二次作业的结束&#xff0c;本学期的OO学习也宣告结束了&#xff08;但还得写博客&#xff09;&#xff0c;下面就对本单元和本次作业做一个总结。 第四单元两次作业的架构设计 ​ 本单元是对UML的结构进行解析&#xff0c;第一次作业是对UML类图的解析&am…

docker linux k8s kubeadm

一. 安装docker 1.添加yum国内依赖 yum -y install yum-utils yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo2.安装docker yum -y install docker-ce docker-ce-cli containerd.io3.启动docker systemctl start docker4…

小程序FMP优化实录,大厂面试题汇总

前言 金九银十面试季&#xff0c;相信大家肯定急需一套Android面试宝典&#xff0c;今天小编就给大家准备了我珍藏已久的Android高阶面试宝典&#xff0c;一份超级详细的Android面试必备知识点&#xff0c;供大家学习 &#xff01; 想必每一个安卓程序员都有追求大厂的决心&a…

文件CRC和MD5校验

文件CRC和MD5校验 CRC和MD5用于文件和数据的传输校验&#xff0c;以确认是否接收成功。 unit CRCMD5;interface { 获取文件CRC校验码 } function GetFileCRC(const iFileName: string): String; { 获取字符串CRC校验码 } function GetStringCRC(const Str: string): Cardinal; …

已成功拿下字节、腾讯、脉脉offer,吐血整理

为什么想跳槽&#xff1f; 简单说一下当时的状况&#xff0c;我在这家公司做了两年多&#xff0c;这两年多完成了一个大项目&#xff0c;作为开发的核心主力&#xff0c;开发压力很大&#xff0c;特别是项目上线前的几个月是非常辛苦&#xff0c;几乎每晚都要加班到12点以后&a…

已成功拿下字节、腾讯、脉脉offer,满满干货指导

开头 笼统来说&#xff0c;中年程序员容易被淘汰的原因其实不外乎三点。 1、输出能力已到顶点。这个人奋斗十来年了&#xff0c;依旧碌碌无为&#xff0c;很明显这人的天花板就这样了&#xff0c;说白了&#xff0c;天赋就这样。 2、适应能力越来越差。年纪大&#xff0c;有家…

ServletRequest HttpServletRequest 请求方法 获取请求参数 请求转发 请求包含 请求转发与重定向区别 获取请求头字段...

原文地址:ServletRequest HttpServletRequest 请求方法 获取请求参数 请求转发 请求包含 请求转发与重定向区别 获取请求头字段ServletRequest 基本概念 JavaWeb中的 "Request"对象 实际为 HttpServletRequest 或者 ServletRequest, 两者都为接口服务器接收请求…

已成功拿下字节、腾讯、脉脉offer,算法太TM重要了

一、背景介绍 从实用角度梳理一篇能够帮大家快速扫盲的CMake基础教程&#xff0c;也是对我目前负责项目的一次学习总结。既然选择从项目实用性考虑&#xff0c;下面的讲解内容可能并不一定完整&#xff0c;更多的是符合项目目前使用到的一些特性。 接下来正面回答这个问题&am…

带你一步一步深入Handler源码,醍醐灌顶!

开头 最近有粉丝反应&#xff0c;不想做安卓了&#xff0c;有朋友转到前端了&#xff0c;安卓不行了&#xff0c;问我怎么办&#xff1f; 自从RN&#xff0c;Weex这种跨平台编程语言出来以后&#xff0c;安卓将死的言论总是不绝于耳。随着颇有摧枯拉朽之势Flutter的出现&…

记得把每一次面试当做经验积累,深夜思考

开头 Android开发&#xff0c;假如开始没有任何的开发经验的话&#xff0c; 千万不要着急&#xff0c;不要想着在短时间内就把一个语言学习好&#xff0c; 因为你之前没有任何的学习经验&#xff0c; 在这个过程中需要有耐心地学习完JAVA的基础知识&#xff0c; 然后才开始踏上…

讲的真透彻!还有人不知道什么是AndroidX的吗?已拿offer入职

前言 春招已经接近尾声了&#xff0c;不知道各位小伙伴有没有收获自己心仪的offer呢。笔者疫情被裁后在家LeetCode狂刷了800多题&#xff0c;加之自己以为工作总结的知识、经验&#xff0c;系统化的整理了一下。在五一期间已经收获了字节的offer。废话不多说&#xff0c;下面是…

Rancher中的服务升级实验

创建一个空的应用myAPP&#xff0c;在myAPP 应用中&#xff0c;创建一个服务nginx-test&#xff0c;包含2个容器副本&#xff0c;使用nginx:1.13.0镜像。假设使用一段时期以后&#xff0c;nginx的版本升级到1.13.1了&#xff0c;如何将该服务的镜像版本升级到新的版本&#xff…

该如何高效实用Kotlin?看这一篇就够了!

前言 说起程序员人们的第一印象就是工资高、加班凶、话少钱多头发少。再加上现在科技互联网公司太吃香&#xff0c;bat、华为小米等公司程序员加班情况被广泛传播&#xff0c;程序员用生命在敲代码的印象刻在了很多人的心里。 与其它行业一样&#xff0c;凡是有高级和普通&…

apply()与call()

JavaScript中的每一个Function对象都有一个apply()方法和一个call()方法&#xff0c;它们的语法分别为&#xff1a; /*apply()方法*/ function.apply(thisObj[, argArray])/*call()方法*/ function.call(thisObj[, arg1[, arg2[, [,...argN]]]]); 它们各自的定义&#xff1a; a…