环境
Windows11
MSYS2
Python 3.11.8
安装Nuitka
由于Nuitka需要gcc环境,需要在Windows上安装MSYS2。但使用MSYS2自带的Python创建虚拟环境安装Nuitka会遇到一些问题。具体的解释和安装过程参考我的另一篇文章:安装Nuitka时遇到pip subprocess to install build dependencies did not run successfully
Windows11
MSYS2
Python 3.11.8
由于Nuitka需要gcc环境,需要在Windows上安装MSYS2。但使用MSYS2自带的Python创建虚拟环境安装Nuitka会遇到一些问题。具体的解释和安装过程参考我的另一篇文章:安装Nuitka时遇到pip subprocess to install build dependencies did not run successfully
使用MSYS2自带的Python3.11.8
创建的虚拟环境下安装Nuitka会报如下错误
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [51 lines of output]
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting cffi==1.16.0
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/68/ce/95b0bae7968c65473e1298efb042e10cafc7bafc14d9e4f154008241c91d/cffi-1.16.0.tar.gz (512 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
[27 lines of output]
Traceback (most recent call last):
......
File "C:\Users\BlueCitizen\AppData\Local\Temp\pip-build-env-r75amcq2\overlay\lib\python3.11\site-packages\setuptools\_distutils\_msvccompiler.py", line 246, in initialize
raise DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
HashMap基于哈希表的Map接口实现,是以key-value存储形式存在,即主要用来存放键值对。HashMap的实现不是同步的,这意味着它不是线程安全的。它的key、value都可以为null。此外,HashMap中的映射不是有序的。
整体为数组,数组的元素是一个个链表,每个链表当中串有若干node。
数组的容量是有限个数的。插入键值对实例时使用哈希算法,先基于哈希函数计算键值的索引(数组的下标),然后插入对应的位置。当发生碰撞时,对比键值是否相等,相等则覆盖,不相等则将新键值对插入到对应位置的链表中。
np.arange(0.95, 0.1, -0.05)
@PathVariable 映射 URL 绑定的占位符
带占位符的URL是Spring3.0的新特性,该功能在SpringMVC向REST目标挺进发展过程中具有里程碑的意义 通过@PathVariable可以将URL中占位符参数绑定到控制器处理方法的入参中:URL 中的 {xxx} 占位符可以通过@PathVariable("xxx") 绑定到操作方法的入参中。
@RequestMapping("/test/{id}")
public String test(@PathVariable("id") Integer testId)
{
return "sucess";
}
IoC属于面向对象编程的设计原则,其目的是降低代码间的耦合度。
最常见的IoC方式是依赖注入DI(Dependency Injection)。还有一种叫做依赖查找Dependency Lookup。以DI为例,IoC是如何体现解耦的呢?
“通过控制反转,对象在被创建的时候,由一个调控系统内所有对象的外界实体将其所依赖的对象的引用传递给它。也可以说,依赖被注入到对象中。”百度百科-控制反转
默认配置下Spring Security会保护所有资源接口,匿名用户将被强制转发到login接口。有时我们并不需要使用默认的登录接口,尤其需要实现前后端分离时。
1、实现AuthenticationEntryPoint接口
/**
* @Author: BlueCitizens
* @Date: 2021/3/13 22:04
* @Description: AuthenticationEntryPoint处理匿名用户访问无权限资源时的异常(未登录,登录状态过期失效等)
*/
@Component
@Slf4j
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException, ServletException {
log.error("Unauthorized access: \ncurrent IP:{}\nrequest URI :{}\n", IpUtils.getIpAddr(request), request.getRequestURI());
String msg = StringUtils.format("Unauthorized access:{},Authentication failed, unable to access system resources ", request.getRequestURI());
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.UNAUTHORIZED, msg)));
}
}
打开srs的配置文件
vim srs/trunk/conf/srs.conf
原生默认的配置
# main config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
srs_log_tank file;
srs_log_file ./objs/srs.log;
daemon on;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
stats {
network 0;
disk sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
hls {
enabled on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
按照github上的说明,先将项目clone到本地编译。据说有安装包方法,没有尝试
clone https://github.com/ossrs/srs
sudo apt update
sudo apt install ffmpeg