JS Code block 代码块–环境判断

星期一, 2023-04-17 | Author: Lee | computer, 前端 | 没有评论 30 views

环境判断
判断是否在微信环境
是否安卓环境
是否iphone环境
是否ios环境(包括iPhone和ipad)
是否safari环境
是否为windows系统
是否为mac系统(包含iphone手机)
是否是支付宝内核
是否是QQ浏览器内核
是否是UC浏览器内核
是否是微博内核
获取浏览器的类型
获取设备像素比
判断 iPhone X Series 机型,刘海屏
› 继续阅读

Tags:

基于phantomjs的截图优化JS信息

星期三, 2023-04-05 | Author: Lee | computer, JAVA-and-J2EE, linux | 没有评论 139 views

phantomjs是比较老的一种模拟抓取及截图,这个是以前处理截图的一种优化js信息做个留档

以后应该是不用了

img.js和rasterize.js两个文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var page = require('webpage').create(), system = require('system'), address, output, size;
 
if (system.args.length < 3 || system.args.length > 5) {
    phantom.exit(1);
} else {
    address = system.args[1];
    output = system.args[2];
    //定义宽高
   /* page.viewportSize = {
        width : 1024,
        height : 768
    };*/
    page.open(address, function(status) {
        var bb = page.evaluate(function() {
            return document.getElementsByTagName('html')[0].getBoundingClientRect();
        });
        page.clipRect = {
            top : bb.top,
            left : bb.left,
            width : bb.width,
            height : bb.height
        };
        window.setTimeout(function() {
            page.render(output);
            page.close();
            console.log('渲染成功...');
            console.log(address);
            phantom.exit();
        }, 1000);
    });
}

› 继续阅读

Tags:

SpringBoot应用的jar包重新打包

星期三, 2023-03-15 | Author: Lee | JAVA-and-J2EE | 没有评论 275 views

1.对应历史的运行中的jar包,需要更改下对应配置 或者其中的一个class文件可以直接使用命令重新打包

2.如下即可

unzip ../my-boot-app.jar
 
vim BOOT-INF/classes/application-pro.properties
 
jar uf ../my-boot-app.jar BOOT-INF/classes/application-pro.properties

3.这样只更新对应的文件即可

Tags:

美化Eclipse链式调用的代码格式化(Formatter)

星期二, 2022-10-18 | Author: Lee | JAVA-and-J2EE | 没有评论 435 views

eclipse下的链式调用格式化的时候挤成一行,看起来很难受.

需要调整 Eclipse 默认的代码格式化——在按下「Ctrl + Shift + F」后,编辑器能够自动将链式调用代码换行。怎么办呢?

在 Eclipse 中按照以下顺序打开代码格式化的配置项:

Windows → Preferences → Java → Code Style → Formatter

选择「New…」新建一个格式化的配置。

关键的配置项如下:

1、Maximum line width:120「一行最大宽度,120」(超过 120 就自动换行)

2、Function Calls → Qualified Invocations「方法调用 → xxxxx」

其中 line wrapping policy 「换行策略」选择:

wrap all elements, except first element if not necessary「第一个元素可以不换行,其他都换行」

并且勾选复选框 force split, even if line shorter than maximum line width「强制换行,即使该行没有达到最大换行的宽度」

这样设置后,Eclipse 就能够为链式调用的代码自动换行了。效果如下图。

不过,这样的换行效果仍然不够理想,如果换行策略优化为:

wrap all elements, except second element if not necessary「前两个元素可以不换行,其他都换行」

这样就更好了。

Tags:

datart更新到jdk17及springboot2.7.4版本执行调整

星期日, 2022-10-16 | Author: Lee | JAVA-and-J2EE, linux | 没有评论 450 views

datart简介:
新一代数据可视化开放平台,支持报表、仪表板、大屏、分析和可视化数据应用的敏捷构建

对应文档地址:https://running-elephant.gitee.io/datart-docs/docs/

GIT地址:https://gitee.com/running-elephant/datart/releases
https://github.com/running-elephant/datart/releases

当前使用版本 datart-1.0.0-rc.1,即此刻master版本

尝试使用jdk17进行编译,使用SpringBoot2.7.4进行parent迁移,修改如下可以比较完美的升级过来.

1.更换 swagger版本,移除springfox相关maven

 
<dependency>
			<groupid>io.springfox</groupid>
			<artifactid>springfox-boot-starter</artifactid>
			<version>3.0.0</version>
		</dependency>

2.引入nashorn的maven,在jdk17中已经移除

<dependency>>
			<groupid>org.openjdk.nashorn</groupid>
			<artifactid>nashorn-core</artifactid>
			<version>15.4</version>
		</dependency>

3.BaseService 启动延迟加载accessLogService服务类

 
 @Autowired
    public void setAccessLogService(@Lazy AsyncAccessLogService accessLogService) {
        this.accessLogService = accessLogService;
    }

4.更改引用包

import org.openjdk.nashorn.internal.parser.TokenType;
import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;
import org.apache.calcite.sql.parser.impl.SqlParserImpl;

5.更换路由匹配模式

spring.mvc.pathmatch.matching-strategy=ant_path_matcher

› 继续阅读

Tags: ,

Nginx解决http host头攻击及Method漏洞

星期一, 2022-10-10 | Author: Lee | computer, JAVA-and-J2EE, linux | 没有评论 457 views

一、HTTP Host头攻击漏洞解决
检测应用是否在请求目标站点时返回的URL是直接将Host头拼接在URI前。

解决方法:验证host

server {
  listen 80;
  server_name 127.0.0.1 192。168.1.8 xxx.com;
  if ($http_Host !~* ^192.168.1.8|127.0.0.1|xx.com$)
  {
    return 403;
  }
}

二、 HTTP Method非POST和GET方式击漏洞解决
尽量用get和post的api的应用,禁用OPTIONS

解决方案:在nginx的server中配置,只允许GET、POST、PUT、DELETE 类型请求通过,其余不安全的请求方式返回403状态码,代码如下。

if ($request_method !~* GET|POST|PUT|DELETE) {
  return 403;
}

Tags:

解决npm install慢的问题 npm更换淘宝国内源

星期五, 2022-09-30 | Author: Lee | 前端 | 没有评论 244 views

不推荐使用cnpm,貌似有小毛病.

1.更换成功taobao的数据源

	npm config set registry https://registry.npm.taobao.org

2.永久修改镜像源

$ npm config list
# 其他查看配置的方式
$ npm config get globalconfig
$ npm config ls -l
 
找到并打开配置文件:~/.npmrc
写入配置:registry=https://registry.npm.taobao.org

3.验证设置是否成功

npm config get registry
# OR
npm info express

4.重要提醒
不推荐通过cnpm 使用,会出现各种莫名的问题

› 继续阅读

解决yum安装docker慢,更换阿里源

星期五, 2022-09-16 | Author: Lee | JAVA-and-J2EE, linux | 没有评论 291 views

1、yum install -y yum-utils
2、yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3、yum install docker-ce

Tags:

2022年mac下还能使用flash的浏览器

星期三, 2022-08-10 | Author: Lee | computer, flash | 没有评论 546 views

flash停止支持已经好几年了,现在市面上常用的chrome等浏览器都已经无法找到开启的模式了

算是彻底封死了启用的可能。

但是但是 还是有需要使用的地方,比如 比较老的OA系统,上传文件就需要flash,咋办呢只有找个还能用的浏览器。

推荐下 360的极速浏览器 安装后依然可以使用flash,下载地址:

mac版本地址:https://browser.360.cn/ee/mac/

主站windows等地址:https://browser.360.cn/

其他的找了一圈,都无法使用,就别浪费时间了,推荐360浏览器.

Tags: ,

设置系统及myslq时区信息,避免程序时间不配置

星期五, 2022-07-29 | Author: Lee | JAVA-and-J2EE, linux | 没有评论 341 views

起因程序用了 date 做查询判断,因系统及mysql不一致,导致插入到数据库的时间和系统时间有差距

造成查询失误,重复插入的问题,故需要调成一致即可.

timedatectl set-timezone "America/New_York"
 
##在[mysqld]区域中加上
vim /etc/my.cnf 
default-time_zone = '-4:00'
###或者##
default-time_zone = 'America/New_York'
 
#/etc/init.d/mysqld restart ##重启mysql使新时区生效

Tags: ,

Search

文章分类

Meta