1、jQuery
https://code.jquery.com/jquery-3.4.0.min.js
代码语言:javascript复制<script src="https://code.jquery.com/jquery-3.4.0.min.js"></script>
2、bootstrap
https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css
https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js
代码语言:javascript复制<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
常用样式:
table
【table-striped】【table-bordered】【table-hover】【table-condensed】
form
【form-control】【btn-primary】【btn-warning】【btn-danger】【disabled】【btn-block】
ul
【nav nav-pills水平ul】【nav-stacked垂直ul】【active选中】【badge徽章】
pre
【pre-scrollable滚动条】
3、vue
https://cdn.staticfile.org/vue/2.4.2/vue.min.js
https://unpkg.com/vue@3.2.31/dist/vue.global.js
代码语言:javascript复制<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
4、ECharts
https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js
代码语言:javascript复制<script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
5、easyUI
https://www.jeasyui.com/easyui/themes/default/easyui.css
https://www.jeasyui.com/easyui/themes/icon.css
https://www.jeasyui.com/easyui/jquery.min.js
https://www.jeasyui.com/easyui/jquery.easyui.min.js
6、React
https://cdn.staticfile.org/react/16.4.0/umd/react.development.js
https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js
https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js
7、maven
外网配配置
代码语言:javascript复制<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:officesoftJavamavenmavenrepository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<!-- 阿里云镜像 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- junit镜像地址 -->
<mirror>
<id>junit</id>
<name>junit Address/</name>
<url>http://jcenter.bintray.com/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
</profiles>
</settings>
mysql5.1.6
代码语言:javascript复制 <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
hadoop2.7.3
代码语言:javascript复制 <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.7.3</version>
</dependency>
mybaits3.4.5
代码语言:javascript复制 <dependencies>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.10</version>
</dependency>
</dependencies>
8、Mybatis
MyBaits-config.xml
代码语言:javascript复制<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="logImpl" value="LOG4J"/>
</settings>
<typeAliases>
<package name="com.item.model"/>
</typeAliases>
<environments default="dev">
<environment id="dev">
<transactionManager type="JDBC"></transactionManager>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mytest?characterEncoding=utf-8"/>
<property name="username" value="root"/>
<property name="password" value="12345678"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/item/mapper/UsersMapper.xml"></mapper>
</mappers>
</configuration>
UsersMapper.xml
代码语言:javascript复制<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.item.mapper.UsersMapper">
</mapper>
log4j.properties
代码语言:javascript复制#全局配置
log4j.rootLogger=debug,stdout,ERROR
#MyBatis日志配直
log4j.logger.com.item.mapper=TRACE
#控制台输出配置
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
9、SSM常用注解、头部、包、
常用注解:
@Controller:作用于表现层(spring-mvc的注解),它注解的类进行前端请求的处理,转发,重定向。包括调用Service层的方法。
@Service:作用于业务逻辑层(service层)
@CrossOrigin:跨域
@GetMapping:Get请求
@PostMapping:Post请求
@Repository:作用于持久层(dao层),它注解的类作为DAO对象(数据访问对象,Data Access Objects),这些类可以直接对数据库进行操作
@Component:是一个通用的Spring容器管理的单例bean组件,最普通的组件,可以被注入到spring容器进行管理。@Component是通用注解,其他三个注解是这个注解的拓展,并且具有了特定的功能。
@RequestParam:用作于将指定参数赋值给方法中的形参。
@RequestMapping:是一个用来处理请求地址映射的注解,可用于类或方法上。用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径。该注解有六个属性:
1、 value, method; value: 指定请求的实际地址,指定的地址可以是URI Template 模式(后面将会说明); method: 指定请求的method类型, GET、POST、PUT、DELETE等; 2、 consumes,produces; consumes: 指定处理请求的提交内容类型(Content-Type),例如application/json, text/html; produces: 指定返回的内容类型,仅当request请求头中的(Accept)类型中包含该指定类型才返回; 3、 params,headers; params: 指定request中必须包含某些参数值是,才让该方法处理。 headers: 指定request中必须包含某些指定的header值,才能让该方法处理请求。
@Autowired:也是用来实现依赖注入的,但是此注解是byType
自动注入的
@ResponseBody:
用指定的格式将一个方法的返回值加载到response的body区域,向手机客户机返回数据信息。如果方法上边不写ResponseBody,那么在最底层使用ModelAndView对象来封装一个方法返回的值。如果传回值是字符串数组,那么立即向移动客户机写入字符串数组。”
头部:
Mapper头部:
代码语言:javascript复制<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
Spring配置文件:applicationContext.xml
代码语言:javascript复制<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
<!-- 加载properties文件·就是刚才写数据库连接信息的文件 -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:jdbc.properties"/>
</bean>
<!-- 配置数据源·你要连接的数据库,为了方便大家,我弄了个一年的数据库,免费使用,但是连接数只有20,别太拥挤 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
<property name="driverClassName" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</bean>
<!-- spring包里封装了有mybatis的SqlSessionFactoryBean工厂,直接用就行 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 获取model包下的模型,这里可能命名不同,entity或者pojo都是,也可能叫javabean -->
<property name="typeAliasesPackage" value="com.item.model"/>
<!-- 获取映射的xml文件,其中*代表所有 -->
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
</bean>
<!-- 数据库工厂直接获取dao层的mapper,也就是将mapper的接口内容拿到 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 这里可以理解成依赖注入sqlSessionFactory -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
<!-- dao层的位置 -->
<property name="basePackage" value="com.item.dao"/>
</bean>
<!-- 事务管理,这就不废话了 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!--数据库连接池-->
<property name="dataSource" ref="dataSource"/>
</bean>
</beans>
MyBaits基础链接信息:jdbc.properties
代码语言:javascript复制driver=com.mysql.jdbc.Driver
url=jdbc:mysql://rm-bp1zq3879r28p726lco.mysql.rds.aliyuncs.com:3306/test?characterEncoding=utf8
username=qwe8403000
password=Qwe8403000
#下面在有需要配置就行,没有需要不用记那么多,用的话过来复制
#初始化链接数量
initialSize=0
#最大连接数,一般20够测试了
maxActive=20
#最多多少空闲在
maxIdle=20
#最少多少空闲在
minIdle=1
#最大等待时间
maxWait=60000
SpringMVC:【spring-mvc.xml】
代码语言:javascript复制<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- 获取item下在所有上下文内容,自己些项目在时候注意改名 -->
<context:component-scan base-package="com.item"/>
<!-- 开注解 -->
<mvc:annotation-driven/>
<!-- 用于views层处理静态资源 -->
<mvc:default-servlet-handler/>
<!-- 处理返回试图的后缀,自己看好路径啊。我自己创建了一个【views】文件夹,里面放所有的视图文件 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 编码格式 -->
<property name="defaultEncoding" value="utf-8"></property>
<!-- 5M的大小 -->
<property name="maxUploadSize" value="2097152"></property>
<!-- 5M的大小 -->
<property name="maxUploadSizePerFile" value="2097152"></property>
</bean>
</beans>
web.xml配置文件
代码语言:javascript复制<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>baidu2</display-name>
<!--初始访问页面-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- ServletContext监听 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- spring核心 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- 格式化编码格式的,免得req和resp配置 -->
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 前端控制器 -->
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
大致会用到的所有包:
代码语言:javascript复制 <!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<!--mybatis所需要的包-->
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<!--数据库事务管理-->
<!-- Spring提供了两种使用JDBC API的最佳实践,
一种是以JdbcTemplate为核心的基于Template的JDBC的使用方式,
另一种则是在JdbcTemplate基础之上的构建的基于操作对象的JDBC的使用方式。 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<!-- Spring-tx模块负责在spring框架中实现事务管理功能。以aop切面的方式将事务注入到业务代码中,并实现不同类型的事务管理器。 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.2</version>
</dependency>
<!--由于为了方便api接口与本地服务的jsp页面所以也要引入jsp包(用作考试的也一样,方便)-->
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- 这里是servlet的api服务Tomcat要用到 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- DBCP是Java的数据库连接池 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!--json-->
<!-- fastjson是一个性能很好的Java语言实现的json解析器和生成器,来自阿里巴巴的工程师开发。是谁就不知道了。 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.12.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.12.2</version>
</dependency>
<!-- JDBC组件 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<!--Java语言中最好的数据库连接池,Druid能够提供强大的监控和扩展功能。
spring boot starter自动装配组件,简化组件引入的开发工作量,
所以Druid推出了druid-spring-boot-starter-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<!-- 分页会用到 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.2.0</version>
</dependency>
<!-- 处理sql的 -->
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>4.0</version>
</dependency>
<!-- 文件上传 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
10、常用正则表达式
匹配网址
代码语言:javascript复制(http|ftp|https)://[w-_] (.[w-_] ) ([w-.,@?^=%&:/~ #]*[w-@?^=%&/~ #])?
匹配手机号
代码语言:javascript复制(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])d{8}
匹配中文
代码语言:javascript复制[u4e00-u9fa5]
11、修改Python镜像
代码语言:javascript复制pip3 config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple
pip3 config list
pip3 install --upgrade pip
需要下载的包【pip3 install requests】
demo示例:
代码语言:javascript复制import requests
import re
import os
from tkinter import *
import tkinter.messagebox as messagebox
root = Tk()
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
dialog_width = 800
dialog_height = 100
# 前两个参数是窗口的大小,后面两个参数是窗口的位置
root.geometry(
"%dx%d %d %d" % (dialog_width, dialog_height, (screenwidth - dialog_width) / 2, (screenheight - dialog_height) / 2))
root.title("去水印下载工具(红目香薰提供):")
Label(root, text='url:').grid(row=0, column=0)
e = Entry(root, width=90)
e.grid(row=0, column=3, padx=10, pady=5)
root.resizable(height=False, width=False)
def show():
try:
oldUrl = e.get()
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
}
short_url = re.findall('(http[|s]?://[^s]*/)', oldUrl)[0]
url = requests.get(url=short_url, headers=headers).url
item_id = url.split('/')[4][0:19]
url = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids={0}".format(item_id)
html = requests.get(url, headers=headers)
title = html.json()['item_list'][0]['desc'] # 抖音视频的文案内容
print(title)
video_id = html.json()['item_list'][0]['video']['play_addr']['uri'] # 视频的uri,也就是video_id
video_url = f'https://aweme.snssdk.com/aweme/v1/play/?video_id={video_id}&ratio=720p&line=0'
mp4 = requests.get(video_url, headers=headers).content
# 开始下载
saveUrl = r"{0}.mp4".format(title)
file = open(saveUrl, "wb ")
file.write(mp4)
file.close()
os.system("explorer .")
messagebox.showinfo("提示", "{0}下载完毕!".format(title))
except:
messagebox.showinfo("提示", "错误路径")
Button(root, text='下载视频', width=10, command=show)
.grid(row=3, column=0, sticky=W, padx=10, pady=5)
mainloop()
bat文件也一样需要创建成一个bat文件,方便直接使用。
代码语言:javascript复制python GetDownRain.py
下载示例
12、Redis常用命令
清空缓存flushall 添加有效时间expire key seconds
redis事务
multi:用来标记一个事务的开始 exec:用来执行一组已压入的队列 discard:清除所有压入队列中的命令,并且结束整个事务