转载:OPENWRT 使用iptables屏蔽p2p下载

编辑/etc/firewall.user,加入以下代码:

保存之后,执行:

即生效。

文章转载来源:https://xintun.lofter.com/post/1dcd13e8_c8fb947

解决vue-echarts的dataZoom在更新后丢失已选位置的问题 | How to solve dataZoom of vue-echarts loses the selected position after updating options

vue-echarts在启用了dataZoom后如果options被更新,dataZoom的start和from会被重置。解决这个问题可以采用下面的方法。

假设你之前是这么配置组件的

首先,在组件上监听dataZoom事件

在data中添加zoomStart和zoomEnd

dataZoom事件有两种触发方式,第一个if分支将在使用滚轮时触发,第二个分支将在拖动手柄时触发。

在data中添加realOptions。然后,在watch下面监听options的变化,将zoomStart和zoomEnd重新赋值。

最后,修改组件的属性

 


If the options are updated after dataZoom has enabled in vue-echarts, the start and from of dataZoom will be reset. The following methods can be used to solve this problem.

Suppose your component looks like this

First, listen to the dataZoom event on the component

Create zoomStart and zoomEnd fields to data.

There are two ways to trigger the dataZoom event. The first if branch will be triggered when the scroll wheel is used, and the second branch will be triggered when the handle is dragged.

Create a realOptions field to data. Then, watch the changes of options and assign zoomStart and zoomEnd.

Finally, modify the properties of your component

 

Compile HATP planner under Ubuntu 16 | Ubuntu 16 编译 HATP

Recently, my project needs the HATP planner. Compiling under Ubuntu 16 encountered the following problems. Here I wrote down some solutions.

Error: Could not find Antlr

This problem is caused by not installing Antlr2.7.7, so we need compile and install Antlr.

First, download the source package from https://www.antlr2.org/download/antlr-2.7.7.tar.gz

You may meet the following problem during compiling, caused by CharScanner.cpp

The solution is to modify the CharScanner.hpp file manually, add the following code at the beginning.

The above modification refers to the following two posts

  1. https://stackoverflow.com/questions/4577453/fcgio-cpp50-error-eof-was-not-declared-in-this-scope
  2. https://stackoverflow.com/questions/7248509/strcasecmp-was-not-declared-in-this-scope

After the compilation and installation, when I tried to execute the antlr command, I got this error: Could not find or load main class antlr.Tool

Then I found that there is no antlr.jar file in the /usr/local/lib directory, just copy this file (in the source code directory) to /usr/local/lib.

Important: When compiling HATP later, please use the following command to declare the executable path of Antlr. Otherwise, you may get this error: Unable to find Antlr executable!

Error: No rule to make target /usr/lib/libantlr.a

Execute the following command.

Error: toaster_msgs/GetInfoDB.h: No such file or directory

This is because toaster is not installed, please visit the following link

https://github.com/laas/toaster/wiki/Installation

Toaster.git can be cloned into the same workspace as HATP and compile together.

Error: No rule to make target ‘/lib/libtoaster.so’

Execute the following command.


最近项目需要HATP规划器,在Ubuntu 16下编译遇到了下面的问题,这里记录一下解决方案。

错误:Could not find Antlr

这个问题是没有安装Antlr2.7.7导致的,我们先编译安装Antlr

首先,下载源码包https://www.antlr2.org/download/antlr-2.7.7.tar.gz

在编译过程中遇到下面的问题,CharScanner.cpp编译失败

解决方案就是手动修改 CharScanner.hpp 文件,在开头加上下面的代码

上面的修改参考了下面两篇文章

  1. https://stackoverflow.com/questions/4577453/fcgio-cpp50-error-eof-was-not-declared-in-this-scope
  2. https://stackoverflow.com/questions/7248509/strcasecmp-was-not-declared-in-this-scope

编译安装结束后,尝试执行 antlr 命令,却提示Error: Could not find or load main class antlr.Tool

然后发现在 /usr/local/lib 目录里没有 antlr.jar 文件,将源码目录中的同名文件拷贝到该目录即可。

非常重要:后面编译HATP的时候,请使用下面的命令执行Antlr的可执行文件路径。否则会出现Unable to find Antlr executable!的问题

错误:No rule to make target /usr/lib/libantlr.a

执行下面的命令

错误:toaster_msgs/GetInfoDB.h: No such file or directory

这是因为没有安装toaster导致的,参考下面的链接https://github.com/laas/toaster/wiki/Installation

其中toaster.git可以克隆到和HATP相同的workspace,一起编译即可。

错误:No rule to make target ‘/lib/libtoaster.so’

执行下面的命令

Ubuntu16 and ROS Kinetic安装ROSPlan | Install ROSPlan with Ubuntu16 and ROS Kinetic

该文章首次编写于2020年1月24日,在该时间点后可能会有新的改变导致安装失败,如果有问题请查看官方文档的更新或给我评论。

我假设你已经安装了ROS核心组件

首先,安装依赖

然后创建一个存放ROSPlan包的工作空间,我假设你使用 ~/ros_playground .

打开这个工作空间的src目录,克隆所需要的文件

 

然后,返回上一级目录,编译

 

使用下面的命令为数据库创建一个文件夹,否则你后面会遇到类似下面的错误

Can’t find database at supplied path ~/ros_playground/src/ROSPlan/rosplan_knowledge_base/common/mongoDB/. If this is a new DB, create it as an empty directory

 

现在,你可以返回官网继续教程了,在启动 tutorial_01.launc 之前别忘了运行 roscore


This article is written on 24 Jan 2020. Some materials may be expired after that time, please check the latest related documents.

Install the following dependencies.

 

Select or create a workspace for the ROSPlan package. I assume you are using ~/ros_playground .

Go to the source folder of your workspace and clone all the necessary packages by using Git.

 

Go to the parent directory and compile these packages

 

Create an empty directory for the new database or you will get an error such like Can’t find database at supplied path ~/ros_playground/src/ROSPlan/rosplan_knowledge_base/common/mongoDB/. If this is a new DB, create it as an empty directory

 

Now, you can try to back to the official tutorial. Please remind before you execute the tutorial_01.launch  you need to run a ROS master node at first. For example, try to execute

 

解决Ubuntu16.04 Python3.5 安装 imgaug,matplotlib,scikit-image包失败的问题 | Solve the problem that imgaug, matplotlib, scikit-image packages cannot be installed with Ubuntu16.04 Python3.5

今天尝试在机器上安装imgaug包来进行数据增强,但是发现因为依赖版本问题无法安装,解决方法如下(Ubuntu 16.04, Python 3.5)

首先,确认自己已经编译安装了Opencv3.5或以上版本,然后运行下面的命令即可

现在,你可以尝试在Python中使用imgaug了


Today, I tried to install the imgaug package on my computer for data augmentation, but this pakcage cannot be installed because of dependencies. The solution is as follows (Ubuntu 16.04, Python 3.5)

First, make sure you have compiled and installed Opencv3.5 or above, and then run the following command.

Now you can try to import imgaug package in Python

2019年10月英国签证T4学生签证申请

随着英国政府颁布学生签证材料审核材料减免的政策之后,申请学生签证变得非常简单。在申请时仅需提交ATAS证书和护照,就可以成功拿到签证。

总结一下在线申请时填写的问题。有一些问题答案比较容易就略过了

Travel information

Q: Will you be travelling to the UK as part of an organised group? 你是否作为某个组织团体的一部分去英国旅行?

A: No

Q: Will you be travelling to the UK with someone who is not your partner, spouse, or dependant? 您会和不是您的伴侣,配偶或受抚养人的人一起去英国旅行吗?

A: No

Q: Date you plan to arrive in the UK

A: 到达英国的具体日期

Course details

Q: What are your course fees for your first year?

A: 填写第一年学费即可

Q: Have you or your parent(s) or legal guardian(s) already paid any of your course fees?

A: 这里如果你已经提前付了学费,比如押金,就选择是并填写金额;如果没有付任何款就选No

Q: Have you or your parent(s)/legal guardian(s) already paid any money to your sponsor for accommodation?

A: 这里如果你已经提前付了住宿费,比如押金,就选择是并填写金额;如果没有付任何款就选No


Q: Name of sponsor institution (school/college/university)

A: 填写学校的名字

Q: Are they going to be a student union sabbatical officer?

A: No

Q: Qualification you will get

A: 这里填写你毕业时获得的证书等级。在CAS上会有明确标注。有的时候不一定能找到完全对应的选项,比如Leeds给我的CAS上写的等级是QCF_NQF8,而列表里并没有这个选项。这时候可以查询学校官方的签证指导说明。Leeds给出的解释是NQF就是RQF等级。所以我这里选择RQF8/SCQF12

Q: Course name

A: 填课程的名字即可


Q: Course start date

A: 课程开始日期

Q: Course end date

A: 课程结束日期

Q: Will you be studying at a school or higher education institution?

A: Higher education institution

ATAS details

Q: Do you need to obtain permission from the ATAS?

A: 这个看你需不需要ATAS证书,CAS上有注明,需要的话一定要提前申请,这个处理时间比较长,一般是20个工作日左右。没有加急

Q: What is your Academic Technology Approval Scheme (ATAS) reference number?

A: 这个在你的ATAS证书上有,注意是Atas reference不是Certificate identifier

Personal information

Q: Do you have a valid national identity card? 有国内身份证,这里填Yes

A: Yes

Q: National identity card number 国内身份证号码

A: Yes

Q: Issuing authority 发证机关

A: XXX公安局一般叫XXX Public Security Bureau


Q: Do you currently hold, or have you ever held, any other nationality or citizenship? 是否拥有过其他国家的公民或国际身份

A: No


Q: How long have you lived at this address?

A:  在这个问题之前会问你在住址。这里是填写你在这个住址多长时间。

Q: What is the ownership status of your home?

A: 如果和父母一起住,这里选Others

Q: Give more details about your living situation, such as who you live with and who owns the property

A: 这里博主是和父母一起住,所以填写It belongs to my parents and I live with them.


Q: Provide your telephone number

A: 这里填写你的手机号就可以,别忘了填写国际区号

Q: Where do you use this telephone number?

A: 填写你上面手机号的使用区域,在中国使用就填For use whilst out of the UK

Passport details

Q: Issuing authority 护照的发证机关

A: MPS Exit & Entry Administration

Do you know where you will be staying in the UK

Q: Do you know where you will be staying in the UK?

A: 这里填写你知不知道去英国要住在哪里,如果不知道写No就好

Accommodation details

Q: Where do you plan to stay in the UK?

A: 这里博主通过学校申请住宿,所以填写的是A student apartment applied through the University of Leeds

Travel history (UK)

Q: Have you applied for leave to remain in the UK in the past 10 years?

A: 如果你在英国申请过居留许可,比如续签或者永居申请,需要填写Yes,否则No

Travel history (other)

这里博主把转机的情况也填写了,选的是Transit (travelling through the country),其他的问题照常写即可。

Sponsor

Q: What is your sponsor licence number?

A: 这个在CAS上有说明,请直接复制

Q: Sponsor’s address

A: 这个有的时候在CAS上没有,到学校官网直接拷贝学校地址即可。如果觉得不靠谱可以考虑搜索学校的签证指导文件。

Q: Did you apply for your course through UCAS?

A: 如果你是通过UCAS申请的,这里就填写Yes


Q: Do you have a Confirmation of Acceptance for Studies (CAS) number?

A: Yes

Q: Confirmation of Acceptance for Studies reference number

A: 这里填你的CAS号码

Q: Are all of the maintenance funds required for this application in a bank account with your name on it?

A: 如果你的保证金存在你的名下,就选Yes,一般都强烈建议存在自己的名下。

English language

Q: Have you successfully completed a course of study in the UK as a Tier 4 (Child) student? 你是否持有过T4儿童签证在英国完成课程?

A: No

Q: Does your Confirmation of Acceptance for Studies (CAS) statement indicate that your English language ability was assessed by your institution or that you are a ‘gifted’ student?

A: Yes

Q: We may have to talk to you about your application. Which language would you prefer to use?

A: English 这个就填English就好,就算使馆给你打电话也是中文

Laravel Union操作后排序错误的问题 Fix the wrong order after using union method in Laravel query

解决方法,在两个子查询中分别加上limit即可。可以使用较大的数确保所有记录返回。

The solution is to use the limit method on the two subqueries. You can use a larger number to ensure that all records are returned.

 

Laravel 5.5在浏览器中预览Notification渲染 Previewing Laravel Notification In Browser

对于Mail,我们可以通过下面的代码在浏览器中预览Mailables

For Mail, we can preview Mailables in the browser with the following code.

然而Notification类中toMail返回的MailMessage实例,Laravel文档中并没有给出直接方法在浏览器中预览,我们可以采取下面的方法。

However, the MailMessage instance returned by toMail method in the Notification class does not give a direct method to preview in the browser in the Laravel document. We can use the following code.

在Laravel5.8及以上,MailMessage实现了Renderable接口(PR in Github),所以可以直接return MailMessage实例作为响应了。

In Laravel 5.8 and above, MailMessage implements the Renderable interface (PR in Github), so you can directly return the MailMessage instance as a response.