FFmpeg新版API接口编译报错解决方法

PIX_FMT_YUV420P -> AV_PIX_FMT_YUV420P


'AVStream::codec': 被声明为已否决:
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO){
=>
if(pFormatCtx->streams[i]->codecpar->codec_type==AVMEDIA_TYPE_VIDEO){


'AVStream::codec': 被声明为已否决:
pCodecCtx = pFormatCtx->streams[videoindex]->codec;
=>
pCodecCtx = avcodec_alloc_context3(NULL);
avcodec_parameters_to_context(pCodecCtx, pFormatCtx->streams[videoindex]->codecpar);


'avpicture_get_size': 被声明为已否决:
avpicture_get_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height)
=>
#include "libavutil/imgutils.h"
av_image_get_buffer_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height, 1)


'avpicture_fill': 被声明为已否决:
avpicture_fill((AVPicture *)pFrameYUV, out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
=>
av_image_fill_arrays(pFrameYUV->data, pFrameYUV->linesize, out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height, 1);


'avcodec_decode_video2': 被声明为已否决:
ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, packet); //got_picture_ptr Zero if no frame could be decompressed
=>
ret = avcodec_send_packet(pCodecCtx, packet);
got_picture = avcodec_receive_frame(pCodecCtx, pFrame); //got_picture = 0 success, a frame was returned
//注意:got_picture含义相反


'av_free_packet': 被声明为已否决:
av_free_packet(packet);
=>
av_packet_unref(packet);



Xcode 编译 OpenCV3

下载CMake,https://cmake.org/download/
下载OpenCV源码,解压

====
GUI编译方法:
安装,启动CMake
Browse Source 指到OpenCV源码目录
Browse Build 指向一个新的目录,例如/Users/lee/Downloads/opencv-3.4.1/gui_release
Configure
选择Unix Makefiles
等待执行完毕
Generate

cd gui_release
make -j4
sudo make install
====

====
命令行编译方法:
安装,启动CMake,打开 Tools - How to install For Command Line Use,按照说明操作

cd /Users/lee/Downloads/opencv-3.4.1
mkdir release
cd release
cmake -G "Unix Makefiles" ..
make
sudo make install
====


====
在终端中使用:
mkdir TestOpenCV
cd TestOpenCV


vi CMakeLists.txt
#版本
cmake_minimum_required(VERSION 2.8)

#项目名称
project( test )

#设置OpenCV所在目录,为后面的find_package提供位置
#OpenCV_DIR为OpenCV源码编译后得到的文件夹(如上面的release目录)
set( OpenCV_DIR /Users/lee/Downloads/opencv-3.4.1/release )

#会在OpenCV所在目录查找配置文件OpenCVConfig.cmake
find_package( OpenCV REQUIRED )

#向工程添加源文件
add_executable( test main.cpp )

#添加链接库
target_link_libraries( test ${OpenCV_LIBS} )


vi main.cpp
#include 
using namespace cv;
int main(int argc, char** argv) {
    Mat image;
    image = imread("/Users/lee/Downloads/20180128214955.jpg", 1);
    namedWindow("Display Image", WINDOW_AUTOSIZE);
    imshow("Display Image", image);
    waitKey(0);
    return 0;
}


cmake .
make
./test
会显示对应的图片
====


====
在Xcode中使用:
创建C++项目
项目属性 - Build Settings - Search Paths
Header Search Path = /usr/local/include/
Library Search Path = /usr/local/lib
在项目下创建lib目录,Add Files To,Command+Shift+G,输入/Usr/local/lib,将所有不带箭头的文件添加进去

#include 
using namespace cv;
int main(int argc, char** argv) {
    Mat image;
    image = imread("/Users/lee/Downloads/20180128214955.jpg", 1);
    namedWindow("Display Image", WINDOW_AUTOSIZE);
    imshow("Display Image", image);
    waitKey(0);
    return 0;
}

编译运行
====

Epson驱动编译

[root@localhost epson-inkjet-printer-escpr-1.6.16]# find / -name “libescpr.so”
/root/epson-inkjet-printer-escpr-1.6.16/lib/.libs/libescpr.so
/usr/local/lib/libescpr.so

[root@localhost epson-inkjet-printer-escpr-1.6.16]# find / -name “libescpr.so”
/root/epson-inkjet-printer-escpr-1.6.16/lib/.libs/libescpr.so
/usr/local/lib/libescpr.so
/opt/epson-inkjet-printer-escpr/lib/libescpr.so

rpm -qp –scripts ../epson-inkjet-printer-escpr-1.6.16-1lsb3.2.x86_64.rpm

ln -sf /opt/epson-inkjet-printer-escpr/ppds /usr/share/ppd/epson-inkjet-printer-escpr

CentOS 7 安装 Tomcat

rpm -qa | grep java
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.141-1.b16.el7_3.x86_64
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64
rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.1.el7_3.x86_64

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm
rpm -ivh jdk-8u144-linux-x64.rpm

vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_144
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${PATH}

source /etc/profile

java -version




http://tomcat.apache.org/download-80.cgi
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz
tar -xvzf apache-tomcat-8.5.20.tar.gz
mv apache-tomcat-8.5.20 /usr/local/

启动Tomcat:
/usr/local/apache-tomcat-8.5.20/bin/startup.sh
关闭Tomcat:
/usr/local/apache-tomcat-8.5.20/bin/shutdown.sh

为Tomcat添加服务:
在Tomcat的安装目录下的bin目录下增加setenv.sh文件:
vi /usr/local/apache-tomcat-8.5.20/bin/setenv.sh
#set JAVA_HOME and JRE_HOME and CATALINA_HOME and CATALINA_BASE
export JAVA_HOME=/usr/java/jdk1.8.0_144
export JRE_HOME=/usr/java/jdk1.8.0_144/jre
export CATALINA_HOME=/usr/local/apache-tomcat-8.5.20
export CATALINA_BASE=/usr/local/apache-tomcat-8.5.20
#set JAVA_HOME and JRE_HOME and CATALINA_HOME and CATALINA_BASE

#add tomcat pid
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
#add Java opts
JAVA_OPTS="-server -XX:PermSize=256M -XX:MaxPermSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m"


创建tomcat.service文件:
vi /usr/lib/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat 8.5.20
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/apache-tomcat-8.5.20/tomcat.pid
ExecStart=/usr/local/apache-tomcat-8.5.20/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target


然后可以执行如下命令来检验是否配置正确:
systemctl enable tomcat.service
systemctl disable tomcat.service
systemctl start tomcat.service
systemctl stop tomcat.service
systemctl restart tomcat.service

出现403 Access Denied
By default the Host Manager is only accessible from a browser running on the same machine as Tomcat
vi /usr/local/apache-tomcat-8.5.20/webapps/manager/META-INF/context.xml


vi /usr/local/apache-tomcat-8.5.20/conf/tomcat-users.xml




systemctl restart tomcat

管理页面:
http://127.0.0.1:8080

代码部署:
1.利用Tomcat自动部署
将WebSitexxx目录拷贝到$CATALINA_HOME/webapps下
/usr/local/apache-tomcat-8.5.20/webapps/WebSitexxx/
访问地址如下:http://localhost:8080/WebSitexxx/

2.修改Server.xml文件部署
更改$CATALINA_HOME/conf/server.xml文件,
vi /usr/local/apache-tomcat-8.5.20/conf/server.xml
编辑Host节点:


CentOS 7 安装 ElasticSearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.0.rpm
rpm --install elasticsearch-5.6.0.rpm
systemctl enable elasticsearch
systemctl start elasticsearch

报错:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x000000008a660000, 1973026816, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1973026816 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /root/elasticsearch-5.6.0/hs_err_pid19703.log
vi /etc/elasticsearch/jvm.options
或
vi config/jvm.options
-Xms2g
-Xmx2g
修改为:
-Xms256m
-Xmx256m

./bin/elasticsearch

curl --proxy "" http://localhost:9200/?pretty

修改Elasticsearch的配置,使其支持外网访问:
vi config/elasticsearch.yml
network.host: 0.0.0.0

报错:
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root
添加专门的用户
useradd elastic
passwd elastic
chown -R elastic:elastic elasticsearch-5.6.0/

报错:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf配置文件
cat /etc/sysctl.conf | grep vm.max_map_count
vm.max_map_count=262144
如果不存在则添加
echo "vm.max_map_count=262144" >>/etc/sysctl.conf
sysctl -p


针对MATLAB 2010b许可证(license)过期问题的解决办法

解决办法:
打开MATLAB安装路径下的license文件夹,用写字本打开里面的LIC文件,将以下代代码替换原有的代码,然后保存退出,重启MATLAB。(matlab R2010b 亲测有效)

INCREMENT Aerospace_Blockset MLM 99 permanent uncounted \
        A05070F00D1EB1F92326 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=216 SN=888888 TS_OK
INCREMENT Aerospace_Toolbox MLM 99 permanent uncounted \
        6090F0C08395D4289512 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=237 SN=888888 TS_OK
INCREMENT Bioinformatics_Toolbox MLM 99 permanent uncounted \
        40E0B0406DE56D23A426 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=190 SN=888888 TS_OK
INCREMENT Cert_Kit_IEC MLM 99 permanent uncounted \
        9080309041D2DCCB2B10 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=179 SN=888888 TS_OK
INCREMENT Communication_Blocks MLM 99 permanent uncounted \
        80E010304ACCEEB5E0AA VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=77 SN=888888 TS_OK
INCREMENT Communication_Toolbox MLM 99 permanent uncounted \
        C0003000770A1A086530 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=162 SN=888888 TS_OK
INCREMENT Compiler MLM 99 permanent uncounted 60D0C0F0DC03C2F72FF7 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=232 SN=888888 TS_OK
INCREMENT Control_Toolbox MLM 99 permanent uncounted \
        6020E0B00B7ECE0893BB VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=7 \
        SN=888888 TS_OK
INCREMENT Curve_Fitting_Toolbox MLM 99 permanent uncounted \
        10703080061FF9DA5A81 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=229 SN=888888 TS_OK
INCREMENT Data_Acq_Toolbox MLM 99 permanent uncounted \
        E0B0E0E05124CF4A1A8D VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=21 SN=888888 TS_OK
INCREMENT Database_Toolbox MLM 99 permanent uncounted \
        0010D0B02CA7353F8314 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=230 SN=888888 TS_OK
INCREMENT Datafeed_Toolbox MLM 99 permanent uncounted \
        40905060D1ECD939538F VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=185 SN=888888 TS_OK
INCREMENT Dial_and_Gauge_Blocks MLM 99 permanent uncounted \
        A0F05070AA9AEBF40588 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=226 SN=888888 TS_OK
INCREMENT Distrib_Computing_Toolbox MLM 99 permanent uncounted \
        5000D00031D2C6B89F9C VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=229 SN=888888 TS_OK
INCREMENT EDA_Simulator_Link MLM 99 permanent uncounted \
        E070C0C02B4B90B5A8D0 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=205 SN=888888 TS_OK
INCREMENT Econometrics_Toolbox MLM 99 permanent uncounted \
        505010F00EB1289A73BA VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=149 SN=888888 TS_OK
INCREMENT Embedded_IDE_Link MLM 99 permanent uncounted \
        90E01090A9BDA4FF67D7 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=254 SN=888888 TS_OK
INCREMENT Excel_Link MLM 99 permanent uncounted E0800080FED6DF10E43F \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=207 SN=888888 TS_OK
INCREMENT Filter_Design_HDL_Coder MLM 99 permanent uncounted \
        3050B02039903259577E VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=181 SN=888888 TS_OK
INCREMENT Filter_Design_Toolbox MLM 99 permanent uncounted \
        3000E0B02C875CDF5823 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=239 SN=888888 TS_OK
INCREMENT Fin_Derivatives_Toolbox MLM 99 permanent uncounted \
        70A010D017A8FA7CE955 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=247 SN=888888 TS_OK
INCREMENT Financial_Toolbox MLM 99 permanent uncounted \
        20E050A0ACC6A69E7AEE VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=241 SN=888888 TS_OK
INCREMENT Fixed-Point_Blocks MLM 99 permanent uncounted \
        E0206040ED6EF9BCCB3B VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=11 SN=888888 TS_OK
INCREMENT Fixed_Income_Toolbox MLM 99 permanent uncounted \
        50E090D0C130F6416176 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=132 SN=888888 TS_OK
INCREMENT Fixed_Point_Toolbox MLM 99 permanent uncounted \
        C07000703494010EF55C VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=154 SN=888888 TS_OK
INCREMENT Fuzzy_Toolbox MLM 99 permanent uncounted \
        D04010B048FB8D350E4E VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=233 SN=888888 TS_OK
INCREMENT GADS_Toolbox MLM 99 permanent uncounted \
        50D0900087384B51643A VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=210 SN=888888 TS_OK
INCREMENT Identification_Toolbox MLM 99 permanent uncounted \
        00707080A0CC0D8FB71E VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=190 SN=888888 TS_OK
INCREMENT Image_Acquisition_Toolbox MLM 99 permanent uncounted \
        50D0D0905C22130C4D2A VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=208 SN=888888 TS_OK
INCREMENT Image_Toolbox MLM 99 permanent uncounted \
        B01030E0F517B496275C VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=133 SN=888888 TS_OK
INCREMENT Instr_Control_Toolbox MLM 99 permanent uncounted \
        80C0505033C162F3017F VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=169 SN=888888 TS_OK
INCREMENT MAP_Toolbox MLM 99 permanent uncounted C090E0E022BD3BA852B3 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=4 SN=888888 TS_OK
INCREMENT MATLAB_Report_Gen MLM 99 permanent uncounted \
        80B000B00052F620FB11 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=190 SN=888888 TS_OK
INCREMENT MATLAB_Distrib_Comp_Engine MLM 99 permanent uncounted \
        804080300CB545FBECE8 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=233 SN=888888 TS_OK
INCREMENT MATLAB_Builder_for_Java MLM 99 permanent uncounted \
        404040707C2CA5639DEE VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=186 SN=888888 TS_OK
INCREMENT MATLAB_Builder_for_dot_Net MLM 99 permanent uncounted \
        8070E0D0FFAA645DA39D VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=255 SN=888888 TS_OK
INCREMENT MATLAB MLM 99 permanent uncounted 50E0F0D08F6CEF24CC5B \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=14 SN=888888 TS_OK
INCREMENT MATLAB_Excel_Builder MLM 99 permanent uncounted \
        50106010BCBF479623D9 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=206 SN=888888 TS_OK
INCREMENT MBC_Toolbox MLM 99 permanent uncounted B05000C02F157C5BEE28 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=198 SN=888888 TS_OK
INCREMENT MPC_Toolbox MLM 99 permanent uncounted 3050206087BF1C33045E \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=203 SN=888888 TS_OK
INCREMENT Neural_Network_Toolbox MLM 99 permanent uncounted \
        D0009010451EEB5A283F VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=198 SN=888888 TS_OK
INCREMENT OPC_Toolbox MLM 99 permanent uncounted 50F070404BE7E269740A \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=198 SN=888888 TS_OK
INCREMENT Optimization_Toolbox MLM 99 permanent uncounted \
        E0F00030546D043DF202 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=152 SN=888888 TS_OK
INCREMENT PDE_Toolbox MLM 99 permanent uncounted 5080705081D393548E6E \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=166 SN=888888 TS_OK
INCREMENT Power_System_Blocks MLM 99 permanent uncounted \
        90405000B77AC9D2CBB9 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=216 SN=888888 TS_OK
INCREMENT Qual_Kit_DO MLM 99 permanent uncounted D01010C04E05A80BCD10 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=190 SN=888888 TS_OK
INCREMENT RF_Blockset MLM 99 permanent uncounted A0A00020B1FED5C15465 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=201 SN=888888 TS_OK
INCREMENT RF_Toolbox MLM 99 permanent uncounted 90F0905068868B4A97C8 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=168 SN=888888 TS_OK
INCREMENT RTW_Embedded_Coder MLM 99 permanent uncounted \
        A0D0E0C0B3978D64A1A3 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=250 SN=888888 TS_OK
INCREMENT Real-Time_Win_Target MLM 99 permanent uncounted \
        300060D0E68A928A0DBC VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=208 SN=888888 TS_OK
INCREMENT Real-Time_Workshop MLM 99 permanent uncounted \
        7020D04006040066FAEA VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=134 SN=888888 TS_OK
INCREMENT Robust_Toolbox MLM 99 permanent uncounted \
        1040201098A2D1E80D25 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=173 SN=888888 TS_OK
INCREMENT SIMULINK MLM 99 permanent uncounted 30D05030E2F9BBB8FCC2 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=213 SN=888888 TS_OK
INCREMENT SIMULINK_Report_Gen MLM 99 permanent uncounted \
        E070B070769E869B6A03 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=206 SN=888888 TS_OK
INCREMENT SL_Verification_Validation MLM 99 permanent uncounted \
        C0309000FB238CC772CC VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=251 SN=888888 TS_OK
INCREMENT Signal_Blocks MLM 99 permanent uncounted \
        F000A0702665C46E07FF VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=196 SN=888888 TS_OK
INCREMENT Signal_Toolbox MLM 99 permanent uncounted \
        E070B0403768324D14C1 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=185 SN=888888 TS_OK
INCREMENT SimBiology MLM 99 permanent uncounted 404080202CFCE52296A3 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=187 SN=888888 TS_OK
INCREMENT SimDriveline MLM 99 permanent uncounted \
        B030A0704195F94612EF VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=163 SN=888888 TS_OK
INCREMENT SimElectronics MLM 99 permanent uncounted \
        F0D050A035E4883B1E9D VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=246 SN=888888 TS_OK
INCREMENT SimEvents MLM 99 permanent uncounted 30E02040EB0C922C71A0 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=216 SN=888888 TS_OK
INCREMENT SimHydraulics MLM 99 permanent uncounted \
        C07090B0F394787D61B7 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=185 SN=888888 TS_OK
INCREMENT SimMechanics MLM 99 permanent uncounted \
        909000103231C13BB4BB VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=148 SN=888888 TS_OK
INCREMENT Simscape MLM 99 permanent uncounted 8020D0906FAC13D095EC \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=211 SN=888888 TS_OK
INCREMENT Simulink_Control_Design MLM 99 permanent uncounted \
        D09060704E819BCDDD32 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=206 SN=888888 TS_OK
INCREMENT Simulink_Design_Optim MLM 99 permanent uncounted \
        6020C080F9B2D2F92E1C VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=243 SN=888888 TS_OK
INCREMENT Simulink_Design_Verifier MLM 99 permanent uncounted \
        8080D0002C390CBB546E VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=196 SN=888888 TS_OK
INCREMENT Simulink_HDL_Coder MLM 99 permanent uncounted \
        F05000C0108BB935AD39 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=215 SN=888888 TS_OK
INCREMENT Simulink_PLC_Coder MLM 99 permanent uncounted \
        803090F0C42068269D45 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=194 SN=888888 TS_OK
INCREMENT Spline_Toolbox MLM 99 permanent uncounted \
        30E0B0A014330227515B VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=112 SN=888888 TS_OK
INCREMENT Stateflow_Coder MLM 99 permanent uncounted \
        2050D0B06F85F87E216B VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=199 SN=888888 TS_OK
INCREMENT Stateflow MLM 99 permanent uncounted 4030C0C01E0B917BED3F \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=223 SN=888888 TS_OK
INCREMENT Statistics_Toolbox MLM 99 permanent uncounted \
        7010C05033AC51015B7C VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=178 SN=888888 TS_OK
INCREMENT Symbolic_Toolbox MLM 99 permanent uncounted \
        80D09090A1ADD082F35D VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=33 SN=888888 TS_OK
INCREMENT SystemTest MLM 99 permanent uncounted B0A0A0E039DA5A2F4AA0 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=29 SN=888888 TS_OK
INCREMENT Target_Support_Package MLM 99 permanent uncounted \
        207000609E1847CC5A6E VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=172 SN=888888 TS_OK
INCREMENT Vehicle_Network_Toolbox MLM 99 permanent uncounted \
        00C02010ABF2A8B8152B VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=11 SN=888888 TS_OK
INCREMENT Video_and_Image_Blockset MLM 99 permanent uncounted \
        107070B0AF7901361B1E VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=162 SN=888888 TS_OK
INCREMENT Virtual_Reality_Toolbox MLM 99 permanent uncounted \
        B010002042F6C767442D VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=205 SN=888888 TS_OK
INCREMENT Wavelet_Toolbox MLM 99 permanent uncounted \
        30C0F0800F9B41DD8577 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=238 SN=888888 TS_OK
INCREMENT XPC_Embedded_Option MLM 99 permanent uncounted \
        102000905C51C5DE4BF0 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=174 SN=888888 TS_OK
INCREMENT XPC_Target MLM 99 permanent uncounted 6090B0000421BEBA6810 \
        VENDOR_STRING=QQ=47399897 HOSTID=ANY ck=136 SN=888888 TS_OK
INCREMENT Sensor_Array_Toolbox MLM 99 permanent uncounted \
        E0008030D7E6251042F1 VENDOR_STRING=QQ=47399897 HOSTID=ANY \
        ck=179 SN=888888 TS_OK

Android NDK 报错

No implementation found for void 
fix way:
check System.loadLibrary() is being called before the method is used.
FFmpeg show A/native-lib: Could not open input file
fix way:
request permission:
private static final int REQUEST_EXTERNAL_STORAGE = 1;
private static String[] PERMISSIONS_STORAGE = {
        "android.permission.READ_EXTERNAL_STORAGE",
        "android.permission.WRITE_EXTERNAL_STORAGE" };


public static void verifyStoragePermissions(Activity activity) {

    try {
    //检测是否有写的权限
        int permission = ActivityCompat.checkSelfPermission(activity,
                "android.permission.WRITE_EXTERNAL_STORAGE");
        if (permission != PackageManager.PERMISSION_GRANTED) {
    // 没有写的权限,去申请写的权限,会弹出对话框
            ActivityCompat.requestPermissions(activity, ISSIONS_STORAGE,REQUEST_EXTERNAL_STORAGE);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Visual Studio 2017 离线安装包下载

注意:一定要安装到默认目录,否则cmake可能会无法识别

下载:
.\vs_Enterprise.exe --layout G:\xxx\vs2017layout --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.WinXP --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Workload.ManagedDesktop --lang zh-CN

安装:
cd G:\xxx\vs2017layout\
.\vs_Enterprise.exe --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.WinXP --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Workload.ManagedDesktop




参数说明:
https://docs.microsoft.com/en-us/visualstudio/install/install-vs-inconsistent-quality-network
https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids

Let’s Encrypt 使用教程,免费的SSL证书,让你的网站拥抱 HTTPS

这篇文章主要讲的就是如何让自己的网站免费从HTTP升级为HTTPS,使用的是 Let’s Encrypt的证书。实际上也就是一个Let’s Encrypt 免费证书获取教程 。 为什么要上HTTPS,说一个小故事。

从前有个网站,后来有个广告,没了

作为一个博客,自然不想让在被别人浏览的时候,出现莫名的广告(运营商劫持)。这时候,HTTPS的价值就体现出来了。 HTTPS的好处还有很多,但单单这一条,就够我花心思去升级了。 (其实主要目的是提升网站Biger :)

Let’s Encrypt 简介

如果要启用HTTPS,我们就需要从证书授权机构(以下简称CA) 处获取一个证书,Let’s Encrypt 就是一个 CA。我们可以从 Let’s Encrypt 获得网站域名的免费的证书。这篇文章也主要讲的是通过 Let’s Encrypt + Nginx 来让网站升级到HTTPS。

Certbot 简介

Certbot 是Let’s Encrypt官方推荐的获取证书的客户端,可以帮我们获取免费的Let’s Encrypt 证书。Certbot 是支持所有 Unix 内核的操作系统的,个人博客的服务器系统是CentOS 7,这篇教程也是通过在个人博客上启用HTTPS的基础上完成的。

获取免费证书

安装Certbot客户端
pip uninstall requests
pip uninstall urllib3
yum remove python-urllib3
yum remove python-requests
yum install python-urllib3
yum install python-requests
yum install certbot
获取证书

systemctl stop nginx
certbot certonly --webroot -w /var/www/example -d example.com -d www.example.com
systemctl start nginx

这个命令会为 example.com 和 www.example.com 这两个域名生成一个证书,使用 –webroot 模式会在 /var/www/example 中创建 .well-known 文件夹,这个文件夹里面包含了一些验证文件,certbot 会通过访问 example.com/.well-known/acme-challenge 来验证你的域名是否绑定的这个服务器。这个命令在大多数情况下都可以满足需求,

但是有些时候我们的一些服务并没有根目录,例如一些微服务,这时候使用 –webroot 就走不通了。certbot 还有另外一种模式 –standalone , 这种模式不需要指定网站根目录,他会自动启用服务器的443端口,来验证域名的归属。我们有其他服务(例如nginx)占用了443端口,就必须先停止这些服务,在证书生成完毕后,再启用。

certbot certonly --standalone -d example.com -d www.example.com

证书生成完毕后,我们可以在 /etc/letsencrypt/live/ 目录下看到对应域名的文件夹,里面存放了指向证书的一些快捷方式。

这时候我们的第一生成证书已经完成了,接下来就是配置我们的web服务器,启用HTTPS。

Nginx 配置启用 HTTPS

博客系统使用的是Nginx 服务器来转发请求,这里贴一下我的Nginx配置。

server {
    server_name isvee.com www.isvee.com;
    listen 443;
    ssl on;
    ssl_certificate /etc/letsencrypt/live/isvee.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/isvee.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:3999;
        proxy_http_version 1.1;
        proxy_set_header X_FORWARDED_PROTO https;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
    }
}

主要是监听 443 端口,启用 SSL,并配置 SSL 的证书路径(公钥,私钥的路径)。
通过这些配置 我们就已经成功的完成了 Https 的启用。
现在打开我的博客 https://isvee.com 就可以看到标有 安全 的字样。

alt

自动更新 SSL 证书

配置完这些过后,我们的工作还没有完成。 Let’s Encrypt 提供的证书只有90天的有效期,我们必须在证书到期之前,重新获取这些证书,certbot 给我们提供了一个很方便的命令,那就是 certbot renew。
通过这个命令,他会自动检查系统内的证书,并且自动更新这些证书。
我们可以运行这个命令测试一下

certbot renew --dry-run
或
certbot certonly --dry-run -d www.isvee.com -d isvee.com
过程中需要输入域名的webroot目录地址

我在运行的时候出现了这个错误
Attempting to renew cert from /etc/letsencrypt/renewal/isvee.com.conf produced an unexpected error: At least one of the required ports is already taken.. Skipping.

alt
这是因为我的isvee.com生成证书的时候使用的是 –standalone 模式,验证域名的时候,需要启用443端口,这个错误的意思就是要启用的端口已经被占用了。 这时候我必须把nginx先关掉,才可以成功。果然,我先运行 service nginx stop 运行这个命令,就没有报错了,所有的证书都刷新成功。

证书是90天才过期,我们只需要在过期之前执行更新操作就可以了。 这件事情就可以直接交给定时任务来完成。linux 系统上有 cron 可以来搞定这件事情。
我新建了一个文件 certbot-auto-renew-cron, 这个是一个 cron 计划,这段内容的意思就是 每隔 两个月的 凌晨 2:15 执行 更新操作。

15 2 * */2 * certbot renew –pre-hook “service nginx stop” –post-hook “service nginx start”
–pre-hook 这个参数表示执行更新操作之前要做的事情,因为我有 –standalone 模式的证书,所以需要 停止 nginx 服务,解除端口占用。
–post-hook 这个参数表示执行更新操作完成后要做的事情,这里就恢复 nginx 服务的启用

最后我们用 crontab 来启动这个定时任务

crontab certbot-auto-renew-cron
至此,整个网站升级到HTTPS就完成了。 总结一下我们需要做什么

获取Let’s Encrypt 免费证书
配置Nginx开启HTTPS
定时刷新证书
鸣谢 Let’s Encrypt 组织以及所有该组织的贡献者支持者 为我们提供 免费的安全证书。

参考: Certbot centosrhel7-nginx
参考: Let’s Encrypt getting-startd
参考: Archlinux cron
参考: Nginx configuring-https-servers

转自:https://my.oschina.net/u/2328699/blog/829503

如果出现如下报错:

Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in 
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in 
    import packaging.requirements
  File "/usr/lib/python2.7/site-packages/packaging/requirements.py", line 59, in 
    MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)

解决方法:

1:(推荐)
wget https://pypi.python.org/packages/d2/f9/60bebd372903c3ca2e9216086ac375d4991cce6261b186e6cf908ef5d49d/pyparsing-2.0.3.tar.gz#md5=0fe479be09fc2cf005f753d3acc35939
tar -xvzf pyparsing-2.0.3.tar.gz
cd pyparsing-2.0.3
python setup.py install

2:(参考 https://bugs.centos.org/view.php?id=12722&history=1)
# yum install ftp://mirror.switch.ch/pool/4/mirror/centos/7.3.1611/cloud/x86_64/openstack-kilo/common/pyparsing-2.0.3-1.el7.noarch.rpm
# pip install docutils