04 2022 档案
摘要:一、安装compodoc npm install --save-dev @compodoc/compodoc 没有使用全局安装,生成文档的时候,需要执行 ./node_modules/.bin/compodoc -p tsconfig.app.json -s -r 9000 编辑package.js
阅读全文
摘要:https://thecodemon.com/angular-oauth2-or-open-id-connect-using-angular-oauth2-oidc-tutorial-with-example-application/
阅读全文
摘要:RedisInsight https://redis.com/redis-enterprise/redis-insight/
阅读全文
摘要:sanctum的控制属性定义在config/sanctum.php 默认用到的middleware中间件是 'middleware' => [ 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 'encrypt_co
阅读全文
摘要:背景: 之前的文章介绍了laravel的cookie生成、加密和响应的原理,cookie自身也是需要一些默认属性的,比如:http_only、same_site、domain、lifetime等等,那么,这些属性的控制参数是在哪里设置的呢? 答案是:config/session.php 默认生成的c
阅读全文
摘要:背景: 在之前的文章中,我已经阐述了laravel的cookie产生的过程,那laravel的cookie在响应到客户端之前,又经历了什么呢? laravel的cookie生成以后,在响应到客户端之前,会经过encrypt的过程,encrypt的加密逻辑定义在src/Illuminate/Cooki
阅读全文
摘要:背景: laravel大家都经常用,cookie也都不陌生,但是你真的知道laravel的cookie是怎么产生的吗? 一、cookie是怎么响应到客户端的? cookie通过addCookieToResponse方法添加到Response,这个方法定义在src/Illuminate/Foundat
阅读全文
摘要:ETag或实体标签(entity tag)是万维网协议HTTP的一部分。 ETag是HTTP协议提供的若干机制中的一种Web缓存验证机制,并且允许客户端进行缓存协商。这就使得缓存变得更加高效,而且节省带宽。如果资源的内容没有发生改变,Web服务器就不需要发送一个完整的响应。ETag也可用于乐观并发控
阅读全文
摘要:http://www.flounder.com/ebcdictoascii1.htm https://www.browserling.com/tools/text-to-ascii https://theasciicode.com.ar/extended-ascii-code/acute-accen
阅读全文
摘要:背景: laravel的Str::random或许大家都不陌生,Str::random定义在src/Illuminate/Support/Str.php,但是你知道它都有哪些应用场景吗? 先来看看,Str::random的代码逻辑,不要被最外层的while骗了,实际上这个while只会执行一次 pu
阅读全文
摘要:背景: get请求/sanctum/csrf-cookie,常用于登录,代码如下: return this.http.get<any>(this.apiURL + ':' + this.port + '/sanctum/csrf-cookie', { withCredentials: true })
阅读全文
摘要:Short answer: withCredentials() makes your browser include cookies and authentication headers in your XHR request. If your service depends on any cook
阅读全文
摘要:下面这篇文章对sanctum介绍的比较全面,可以作为参考 https://learnku.com/docs/laravel/8.x/sanctum/9421
阅读全文
摘要:背景: 父模块的pom.xml引入jwt的依赖,如下: <!-- jwt --> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt-api</artifactId> <version>0.11.1</version> <
阅读全文
摘要:参考资料: https://www.geeksforgeeks.org/new-self-vs-new-static-in-php/
阅读全文
摘要:背景: 在之前的文章里,介绍了APP_KEY的生成原理和作用,APP_KEY其中的一个主要目的就是用于laravel实现对cookie的加密。 laravel首先会通过src/Illuminate/Encryption/EncryptionServiceProvider.php里的parseKey方
阅读全文
摘要:有两种方法 第一种: use Illuminate\Support\Facades\Log; Log::info(json_encode($user); 第二种: use Illuminate\Support\Facades\Log; Log::info(print_r($user, true));
阅读全文
摘要:Gates are simply closures that determine if a user is authorized to perform a given action. 参考资料: https://laravel.com/docs/9.x/authorization
阅读全文
摘要:背景: laravel的.env里有一项配置参数,叫APP_KEY,生成APP_KEY的命令,如下: php artisan key:generate 这是用于给APP_KEY赋值的自定义command,定义在src/Illuminate/Foundation/Console/KeyGenerate
阅读全文
摘要:所有自定义命令,都是通过extends Command实现的,对应的处理逻辑在handle方法里
阅读全文
摘要:laravel里的服务、第三方包的服务,都是通过extends ServiceProvider实现的,ServiceProvider是一个abstract class
阅读全文
摘要:背景: SANCTUM_STATEFUL_DOMAINS是.env里的一个配置选项,在controller控制器里使用.env('SANCTUM_STATEFUL_DOMAINS')获取,一直都是正常的,突然就报了null 分析:首先,确认了.env里SANCTUM_STATEFUL_DOMAINS
阅读全文
摘要:背景: laravel的api使用的是scantum扩展包。 在以post方式提交login登录的时候会先get方式调用scantum/csrf-cookie路由,这个路由的响应方法,定义在src/Http/Controllers/CsrfCookieController.php public fu
阅读全文
摘要:背景: 手动删除了laravel根目录bootstrap文件夹下的cache文件夹,通过浏览器访问的时候,报错:The /var/www/example-app/bootstrap/cache directory must be present and writable. 解决: 手动创建cache
阅读全文
摘要:第一步:在我们自定义的LoginService里,使用@Resource注入一个AuthenticationManager @Resource private AuthenticationManager authenticationManager; 注入AuthenticationManager以后
阅读全文
摘要:背景: 首先,要说明的是,无论PHP还是Java,使用bcrypt进行hash得到的密文字符串长度都是60,其中密文的前4位,称为salt // php版是 $2y$10$Cih2shiBNg5jWrj0i.2hbuzZ5.g9T6caaxNP4yYtp3.wpi48rXomu // java版是
阅读全文
摘要:有两种实现方式 一、在application.yml添加如下配置 mybatis-plus: # config-location: classpath:mybatis/mybatis-config.xml mapper-locations: classpath*:mybatis/mapper/**/
阅读全文
摘要:主启动类所在模块的pom.xml,添加junit依赖,如下: <!-- springboot的测试框架,里面有对junit4的依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot
阅读全文
摘要:一、父模块的pom.xml添加HiKariCP连接池依赖 <!-- HiKariCP连接池 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artif
阅读全文
摘要:spring boot的配置文件分为properties和yaml两种格式,用下面这个网站提供的转换工具,可以方便的进行格式互转 https://toyaml.com/index.html
阅读全文
摘要:背景: 父子工程项目结构,主启动类在子工程app模块 一、在父模块的pom.xml里引入mybatis-plus依赖 <!-- mybatis plus --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus
阅读全文
摘要:背景: spring boot 2.1.0 集成 mybatis-plus后,按照官方文档的例子,在父模块里,写了一个单元测试,如下: @RunWith(SpringRunner.class) @SpringBootTest() public class SampleTest { private s
阅读全文
摘要:在controller里定义了一个普通的get接口,通过postman访问出现上图的401错误,查看启动信息,发现spring security也启动了,但是pom.xml里并没有引入spring security的依赖,不管是重新clean打包,还是执行 mvn dependency:purge-
阅读全文
摘要:一、查看topic列表 mqadmin.cmd topicList -n localhost:9876 二、查看consumer mqadmin.cmd consumerProgress -n localhost:9876 参考资料 https://www.cnblogs.com/gmq-sh/p/
阅读全文
摘要:前提: 客户端提交header,设置Content-Type类型为:application/json,这一项设置可有可无,但是为了避免出现其他不可预料的问题,事先说明,建议添加这一项请求头header设置。 一、使用@RequestParam @RequestMapping(value = "/lo
阅读全文
摘要:一、升级angular 8 到 angular 8 的最新版本,再升级到 angular 9,依次升级到 angular 13 ng update @angular/core@8 @angular/cli@8ng update @angular/cli@9 @angular/core@9ng upd
阅读全文
摘要:背景: Angular 8.3.20 + Tailwind CSS 3.0.24 一、npm 安装 Tailwind CSS npm install -D tailwindcss 二、初始化 Tailwind CSS npx tailwindcss init 初始化以后,会在project根目录下生
阅读全文
摘要:在ruoyi-admin的pom.xml里添加kafka的依赖配置,如下: <!-- kafka 依赖 开始 --> <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifac
阅读全文
摘要:子查询的表行数少的时候,用in合适 子查询的表行数多的时候,用exists合适 如果子查询的表里存在null,in将不能进行比较,这种情况只能使用exists 参考资料 SQL Exists vs. IN clause
阅读全文
摘要:二进制树:binary tree,每一个node节点,有2个子节点,左边的总是小于右边的 二进制搜索数:binary search tree,简称:BST BST树的查询时间复杂度是O(N),为了优化BST树,而诞生了另外两种树,分别是:自平衡二进制搜索树,红黑树,其目的是将查询的时间复杂度由O(N
阅读全文
摘要:缓存穿透:访问一个不存在的key 缓存雪崩:大面积得key失效 缓存击穿:访问一个失效的key
阅读全文
摘要:一、创建component组件 ng generate component test/hello 二、创建service服务 ng generate service service/task 三、创建model 与上面不同的是,angular的model,叫interface更贴切,因此,命令应该如
阅读全文
摘要:参考资料 Get data from a server
阅读全文
摘要:背景: Debian 10 + Angular 11 由于官方提供的demo是基于Angular 7的,已经过时了,其他能查到的资料大多是基于Vue的,因此,使用Angular 11 自己总结了一套方法,最终封装的甘特图组件效果如下: 第一步: npm install dhtmlx-gantt --
阅读全文
摘要:rem和px的比例是1:16,也就是说2.5rem,等同于 2.5 * 16 = 40px 参考资料 https://codebeautify.org/rem-to-px-converter
阅读全文
摘要:父组件向子组件传值,通过在子组件定义@Input接收父组件传过来的内容 子组件向父组件传值,通过在子组件定义@Output和EventEmitter向父组件发送要传递的内容 也可以通过rxjs实现组件间传值,使用rxjs在组件间传值最灵活,但是相对来说也最麻烦 参考资料 https://angula
阅读全文
摘要:简而言之,fixed是和static完全相反的属性,static会根据文档流进行相对定位,fixed则完全相反。
阅读全文
摘要:这篇文章把概念和原理做了详细的介绍,可以参考看完就会的SpringBoot自动装配原理 - SegmentFault 思否
阅读全文
摘要:WORKSPACE_TIMEZONE=UTC 改为 WORKSPACE_TIMEZONE=PRC 参考资料 Laradock注意事项 - caibaotimes - 博客园 (cnblogs.com)
阅读全文
摘要:一、下载Ruoyi-Cloud源码 git clone https://gitee.com/y_project/RuoYi-Cloud.git 二、安装并启动mysql和redis 此步骤略 三、创建数据库 依次创建ry-cloud、ry-config、ry-seata三个数据库,导入对应的sql
阅读全文
摘要:5W1H系列 | Nacos 帮我们解决什么问题?(配置管理篇)-阿里云开发者社区 (aliyun.com)
阅读全文
摘要:打开.m2/settings.xml,找到mirrors,把其中的默认设置注释掉,添加下面这段: <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://mav
阅读全文
摘要:在pom.xml里,添加下面这段 <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</arti
阅读全文
摘要:幻读:phantom read,是指同一个事务的查询,前后两次得到的结果不一致,侧重点在于读取到的结果集的行数,比如,上一次读得到的结果集是100行,下一次读得到的结果集变成了101行。 不可重复度:non-repeatable read,是指对同一个结果集,前后两次读的结果不一致,不可重复读的结果
阅读全文
摘要:wget http://mirrors.advancedhosters.com/apache/ant/binaries/apache-ant-1.10.12-bin.tar.gz sudo tar xvfvz apache-ant-1.10.12-bin.tar.gz -C /optsudo ln
阅读全文
摘要:laravel 8,首次访问报错如下: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `sessions` where `id` = g9NiFsTVwmc4sbj2JuAWZHhriQ9w1QQDUgu0ehMO lim
阅读全文
摘要:一、安装jetstream composer require laravel/jetstream 二、安装inertia.js php artisan jetstream:install inertia 参考资料 https://jetstream.laravel.com/2.x/installat
阅读全文
摘要:以laravel 8为例 一、使用artisan php artisan test 二、使用shell ./vendor/bin/phpunit 使用artisan创建单元测试 php artisan make:test UserTest --unit
阅读全文
摘要:你知道吗,laravel的魅力远不止于仅仅是个开发框架,laravel还自带励志的人生格言,在你困顿的时候带给你灵感! 在 src/Illuminate/Foundation/Inspiring.php 里,有一大段格言,使用下面的命令就可以获得 php artisan inspire 意不意外,惊
阅读全文
摘要:一、大家都能想到的 打开composer.json,找到laravel/framework,后面对应的就是版本信息 二、使用artisan php artisan --version 三、使用tinker php artisan tinker 进到tinker命令行,执行 app()->versio
阅读全文
摘要:一、使用composer创建laravel 8 composer create-project laravel/laravel:^8.0 example-app 报错: COMPOSER_AUTH" does not match the expected JSON schema, this may
阅读全文
摘要:sql injection翻译过来就是sql注入,是指通过构造特定组合的字符串,欺骗应用程序,执行错误的业务逻辑。 明白了sql注入的概念,再来思考怎么预防?在laravel里,通常有以下三种方法来预防sql注入,分别是: 1.使用Validator验证页面提交的参数 $validator = Va
阅读全文
摘要:不需要提前安装composer,在Linux下,要安装composer,需要先安装php环境,如果我们用docker,这样做显然是不必要的,那有没有更简单的方法呢? 那就是使用laravel给我们准备的shell,执行如下命令: curl -s https://laravel.build/test-
阅读全文
摘要:以laravel 8为例 # 进入tinker命令行 php artisan tinker 参考资料 https://laravel.com/docs/4.2/artisan https://laravel.com/docs/9.x/artisan#main-content https://lara
阅读全文
摘要:在不同版本的laravel里都提供有cli,此处以laravel 8为例: -- 生成migration,laravel 8生成的migration里默认使用$table->id()代表主键,也可以使用$table->increment('id')代替 php artisan make:migrat
阅读全文
摘要:背景: laravel 8 ,要迁移的mysql表数据结构如下: cars表: + + + + + + + | Field | Type | Null | Key | Default | Extra | + + + + + + + | id | int unsigned | NO | PRI | N
阅读全文
摘要:一、laravel-ray(需要安装客户端app) 1.安装 composer require spatie/laravel-ray 2.发布 php artisan ray:publish-config # 这会在你项目的根目录生成 ray.php 3.安装客户端 app 以Windows为例,参
阅读全文
摘要:一、laradock启用supervisor 1 - Open the .env file 2 - Set WORKSPACE_INSTALL_SUPERVISOR and WORKSPACE_INSTALL_PYTHON to true. 3 - Create supervisor configu
阅读全文
摘要:环境:MySQL 8.0.25 -- 备份数据库 mysqldump -hlocalhost -uroot -p --databases scan_app > /home/backup/scan_app.sql -- 恢复数据库,如果没有对应的数据库,则先执行 create database sca
阅读全文
摘要:有符号int最大可以支持到约22亿,远远大于我们的需求和MySQL单表所能支持的性能上限。对于OLTP应用来说,单表的规模一般要保持在千万级别, 不会达到22亿上限。如果要加大预留量,可以把主键改为改为无符号int,上限为42亿,这个预留量已经是非常的充足了。 使用bigint,会占用更大的磁盘和内
阅读全文
摘要:1.修改 .env ,把 INSTALL_AMQP = false 改为 INSTALL_AMQP = true 2.切换到laradock目录下,执行 docker-compose up -d rabbitmq 第2步出现了:error pulling image configuration: G
阅读全文
摘要:# 注意 -F: 与 '{print $1}' 之间要有空格 cat /etc/passwd | awk -F: '{print $1}'
阅读全文