OnePlus 5T刷机

OnePlus 5T OxygenOS http://downloads.oneplus.net/
H2OS http://www.h2os.com/download

http://www.oneplusbbs.com/thread-3841246-1-13.html

第一步:打开手机设置-关于手机-连续点击版本号(5-7次)打开开发者选项
第二步:设置-开发者选项-打开OEM解锁、USB调试和高级重启选项

下载一加5T工具箱v1.5.3版 http://www.oneplusbbs.com/thread-3798911-1-1.html

启动工具箱
0 检查手机状态
16 启动设备到Fastboot模式

3 检查是否解锁
4 解锁手机(解除BootLoader锁)
手机按照提示选YES

9 刷写ROM或ZIP包(从USB安装升级文件)
拖入rom文件到5T工具箱
注意:ROM文件路径中不能出现中文

重启
!!!拷贝APP到手机!!!

6) 刷写第三方Recovery(TWRP)
自带的twrp-3.2.1-0

8) 刷写自选Recovery
拖入twrp-3.2.1-1-dumpling.img文件到5T工具箱
注意:ROM文件路径中不能出现中文

刷入氧OS:
重启设备到Recovery模式
如果您是第三方TWRP Recovery,刷写任意ROM或ZIP包(ROOT权限包等),请依次点击”Advanced”(高级) ADB Sideload,并滑动 显示”正在启动adb sideload”即为启动成功

音量键加 + 电源键,进入FastBoot模式
8) 刷写自选Recovery
拖入twrp-3.2.1-1-dumpling.img文件到5T工具箱
注意:ROM文件路径中不能出现中文

进入twrp
刷入SuperSU
重启

打开SuperSU

设置 – 按键 – 切换按钮
Home键长按操作:关闭屏幕

Nexus 6P刷机

下载:
https://dl.twrp.me/angler/
http://www.supersuer.com/
http://repo.xposed.info/module/de.robv.android.xposed.installer

刷入系统:
flash-all.bat

启动并按提示设置完毕

刷入twrp:
fastboot flash recovery twrp-3.2.1-0-angler.img
再执行一次:
fastboot flash recovery twrp-3.2.1-0-angler.img

开机
拷贝SuperSU-v2.82-201705271822.zip到SD卡

重启手机进入recovery
刷入SuperSU

去除网络连接感叹号:
adb shell settings put global captive_portal_mode 0

安装XposedInstaller_3.1.4.apk

VS2015 vcpkgsrv.exe进程CPU占用高的解决方法

是 VC 智能感知问题,可以禁了。
方法是: 菜单: 工具 -》 选项 -》 文本编辑器 -》 C++ -》 高级
右边 Intellisense false 改为 Ture
注意:此设置会导致无法使用代码高亮与智能提示

其他减少VS的CPU占用率的方法:
工具 -》 选项 -》 搜索codelens, 将 启用 取消勾选,重启VS
工具 -》 选项 -》 源代码管理 -》 当前源代码管理插件:无

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