iott / dev-notes Goto Github PK
View Code? Open in Web Editor NEWDevelopment notes about Node.js、 Redis、MySQL、Git、Other
Development notes about Node.js、 Redis、MySQL、Git、Other
开发中有个需求把geojson文件转化为shp文件,其中的属性值为中文,通过ogr2ogr转换的结果查看发现乱码,然后各种查询和搜索最终得以解决
ogr2ogr -f "ESRI Shapefile" f:\\gdal\\countries.shp f:\\gdal\\countries.geojson
ogr2ogr --config SHAPE_ENCODING "UTF-8" -f "ESRI Shapefile" f:\\gdal\\countries.shp f:\\gdal\\countries.geojson
or
ogr2ogr --config SHAPE_ENCODING "UTF-8" -f "ESRI Shapefile" f:\\gdal\\countries.shp f:\\gdal\\countries.geojson
由于之前从未接触过GIS,本文粗浅的记录一些涉及到的函数,便于日后翻阅。
SELECT * FROM `polygons`
WHERE mbrIntersects(ogc_geom,
GeomFromText('POLYGON((-18 120,-10 120,-10 140,-18 140, -18 120))'));
select ST_WITHIN(ST_GeomFromText('POINT(123.7550476770001 48.29881346700004)'),ST_GeomFromText("POLYGON((123.7550476770001 48.29881346700004,123.754951105 48.29876770200008,123.7547182170001 48.29896478300005,123.7538080500001 48.29853876000006,123.7540577190001 48.29835305800005,123.7537012780001 48.29830251100005,123.753545848 48.29847929300011,123.75315602 48.29836059100005,123.7529432980001 48.29856224300004,123.753799132 48.299119832,123.7543766760001 48.29942498400002,123.7544152390001 48.29945213900005,123.7550476770001 48.29881346700004))"))
1.箭头函数与普通函数的区别?
(1)简洁
///function定义函数
function aaa(a,b){
return a+b;
}
///箭头函数定义函数
var aaa=(a,b)=>{return a+b;}
(2)this指向
function传统定义的函数,this指向随着调用环境的改变而改变,而箭头 函数中的指向则是固定不变,一直指向定义环境的。
///function定义函数中的this指向
function aaa(){
console.log(this)
}
var obj={
aaa:aaa
};
aaa();//此时输出window对象
obj.aaa();//此时输出obj对象
///箭头函数中的this指向
var aaa=()=>{
console.log(this)
};
var obj={
aaa:aaa
}
aaa();//此时指向window
obj.aaa();//此时指向window
(3)构造函数
箭头函数固然好用,但是不能用于构造函数,即不能使用new
///使用function方法定义构造函数
function per(){
this.name='aaa';
this.sex='man'
};
var ming=new per();
console.log(ming); /// {name: "aaa", sex: "man"}
///使用箭头函数定义构造函数
var per=>{
this.name='bbb';
this.sex='women';
};
var gang=new per();
///运行便会报错:Uncaught TypeError: per is not a constructor
(4)变量提升
由于js的内存机制,function的级别最高,而用箭头函数定义函数的时候,需要var(let const定义的时候更不必说)关键词,而var所定义的变量不能得到变量提升,故箭头函数一定要定义于调用之前!
//function定义函数时候的位置
aaa();//aaa
function aaa(){
console.log('aaa')
}
///箭头函数定义的位置
var aaa=()=>{
console.log('aaa')
};
aaa();//aaa
bbb();///报错bbb is not a function
var bbb=()=>{
console.log('bbb')
}
2.代理与反向代理的区别及各自的用途?
3.Redis数据类型有哪些及各自的使用场景?
参考
4.Redis key过期策略、数据过期机制、Redis集群配置/主从/哨兵模式
5.docker与虚拟机的区别及两者各自的优缺点
6.express/koa/egg区别差异是否读过源码
7.中间件的实现原理是什么
8.异步处理有哪些方式,原理分别是什么?
Promise探讨
JavaScript基础——Promise使用指南
JavaScript基础——回调(callback)是什么?
JavaScript基础——你真的了解JavaScript吗?
也许,这样理解HTTPS更容易
事件循环机制的那些事
9.线程与进程的区别
11.什么是闭包
12.谈谈对this的认识
13.cookie与session的区别是什么
14.mysql数据库引擎有哪些及各自的特点
15.MySQL索引有哪些及各自的特性和应用场景
16.Rest api 请求方式有哪些,put和post有何区别
17.css常见的定位方式
18.谈谈对react的理解,是否有了解过diff算法
19.state与props的区别
20.常见面试题筛选
2018年,最常见的26个JavaScript面试题和答案
木易杨
阿里一面:关于【缓存穿透、缓存击穿、缓存雪崩、热点数据失效】问题的解决方案
记一次蚂蚁金服的面试经历
大厂前端高频面试问题与答案精选
腾讯前端面试篇和详细题解(二)
叮!阿里offer请查收!--【一周面试题】
程序猿的今日头条面试历险记(一)
【一周面试题】12月x厂面试题
百度秋招面试题
简单高效的sort排序&经典案例解析
javascript高级排序算法之归并排序
FEGuide基础面试库
2018大厂高级前端面试题汇总
常见 React 面试题
深入理解浏览器的缓存机制
22.前端进阶系列
23.前端面试指南
26.js数组常用的方法
27.作用域
28.常见的数据结构与算法
29.V8引擎及垃圾回收机制
30.高级前端进阶
本文只记录docker常用命令,如果想了解每一个选项的细节,请参考官方文档,这里只作为自己以后的备忘记录下来。
容器生命周期管理
docker [run|start|stop|restart|kill|rm|pause|unpause]
容器操作运维
docker [ps|inspect|top|attach|events|logs|wait|export|port]
容器rootfs命令
docker [commit|cp|diff]
镜像仓库
docker [login|pull|push|search]
本地镜像管理
docker [images|rmi|tag|build|history|save|import]
其他命令
docker [info|version]
docker info
cd DockerFile所在目录
docker build -t 镜像名 .
docker run -it 已有镜像名称 /bin/bash
docker commit 容器ID 镜像名称
docker images 或 docker images --no-trunc
docker rmi b39c68b7af30 镜像名称
注:对于存在容器的镜像,首先需要删除其对应的容器才能删除该镜像
docker tag 旧镜像名称 新镜像名称
注:该命令会在原有的镜像上重新生成一个新的镜像名称对应该镜像
docker pull 镜像名称
注:该命令会在对应的镜像仓库查询镜像并拉取到本地
docker push 镜像名称
docker运行容器的基本命令:
docker run -参数 镜像名称 执行命令
运行容器命令可以分解为三个部分,分别是参数,镜像名称和执行命令
1. -it:-i参数用设置容器中的STDIN是开启的。-t参数表示为创建的容器分配一个伪tty终端。 二者通常联合使用。
2. --name 容器名:用于为启动的容器设置一个容器名称。
3. -d:将程序放在后台执行,用于创建守护式容器。
4. --restart:设置自动重启,可以设置什么情况下重启,例如--restart=always,--restart=on-failure:5。
5. -p:端口映射。例如:8000:80表示将容器的80端口映射到宿主机的8000端口。80表示将容器的80端口映射到宿主机的任意端口。
6. -P:端口映射,将容器Dockerfile中EXPOSE指定的端口映射到宿主机的任意端口。
7. -w:指定工作目录
8. -h:为容器设置HOST主机名称。
9. --entrypoint:强制指定启动程序。
10. -v:卷映射。示例:/home/nianshi/logs:/logs表示将宿主机的/home/nianshi/logs目录挂载到容器的/logs目录下。
11. --link:容器链接。示例:redis:db表示将容器名称为redis的容器连接到新建的容器上,同时设置别名为db。此时在新容器中可以使用db来表示redis容器的地址。
12. --volumes-from:参数用于连接某个指定容器的卷,从而可以访问到指定容器中的所有的卷。示例:blog_demo表示新容器中挂载了blog_demo容器中所有的卷。
13. --rm:表示容器运行完成后自动删除。
/bin/bash
docker start 容器名称/容器ID
docker stop 容器名称/容器ID
当我们启动了一个有交互式运行环境的容器时,可以执行如下命令来进入交互式环境。
docker attach 容器名/容器ID
或
docker exec -it 容器名称/容器ID
docker exec -参数 容器名称/容器ID 执行命令
docker ps -a
docker ps
docker inspect 容器名称/容器ID
docker stats
docker port 容器名称/容器ID
docker top 容器名称/容器ID
docker logs 容器名称/容器ID
注:可以添加-f来监控日志文件,-t参数来增加时间戳。
docker run -d 容器名
docker stop 容器名称/容器id
docker start 容器id
docker rm 容器名称/容器ID
docker rm `docker ps -a -q`
docker cp /ROOT.war mytomcat2:/usr/local/tomcat/webapps
注: cp:拷贝命令;将ROOT.war文件拷贝到mytomcat2容器中的/usr/local/tomcat/webapps目录下
complete example:
// server.js
var soap = require('strong-soap').soap;
var http = require('http');
var myService = {
CheckUserName_Service: {
CheckUserName_Port: {
checkUserName: function(args, soapCallback) {
console.log('checkUserName: Entering function..');
soapCallback(args);
}
}
}
};
var xml = require('fs').readFileSync('check_username.wsdl', 'utf8');
var server = http.createServer(function(request,response) {
response.end("404: Not Found: " + request.url);
});
var port = 8000;
server.listen(port);
var soapServer = soap.listen(server, '/test', myService, xml);
soapServer.log = function(type, data) {
console.log('Type: ' + type + ' data: ' + data);
};
console.log('SOAP service listening on port ' + port);
//client.js
"use strict";
var soap = require('strong-soap').soap;
var url = 'http://localhost:8000/test?wsdl';
var options = { endpoint: 'http://localhost:8000/test'};
var requestArgs = { userName: "TEST_USER" };
let method="checkUserName";
soap.createClient(url, options, function(err, client) {
if (err) {
console.error("An error has occurred creating SOAP client: " , err);
} else {
console.log("client:",client);
var description = client.describe();
console.log("Client description:" , description);
// var method = client.checkUserName;
var method = client["CheckUserName_Service"]["CheckUserName_Port"]["checkUserName"];
console.log(method,111);
method(requestArgs, function(err, result, envelope, soapHeader) {
// client.checkUserName(requestArgs, function(err, result, envelope, soapHeader) {
//response envelope
console.log('Response Envelope: \n' + envelope);
//'result' is the response body
console.log('Result: \n' + JSON.stringify(result));
});
}
});
//check_username.wsdl
<definitions name = "CheckUserNameService"
targetNamespace = "http://www.examples.com/wsdl/CheckUserNameService.wsdl"
xmlns = "http://schemas.xmlsoap.org/wsdl/"
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns = "http://www.examples.com/wsdl/CheckUserNameService.wsdl"
xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
<message name = "CheckUserNameRequest">
<part name = "userName" type = "xsd:string"/>
</message>
<message name = "CheckUserNameResponse">
<part name = "status" type = "xsd:string"/>
</message>
<portType name = "CheckUserName_PortType">
<operation name = "checkUserName">
<input message = "tns:CheckUserNameRequest"/>
<output message = "tns:CheckUserNameResponse"/>
</operation>
</portType>
<binding name = "CheckUserName_Binding" type = "tns:CheckUserName_PortType">
<soap:binding style = "rpc"
transport = "http://schemas.xmlsoap.org/soap/http"/>
<operation name = "checkUserName">
<soap:operation soapAction = "checkUserName"/>
<input>
<soap:body encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" namespace = "urn:examples:CheckUserNameService" use = "encoded"/>
</input>
<output>
<soap:body encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" namespace = "urn:examples:CheckUserNameService" use = "encoded"/>
</output>
</operation>
</binding>
<service name = "CheckUserName_Service">
<documentation>WSDL File for CheckUserNameService</documentation>
<port binding = "tns:CheckUserName_Binding" name = "CheckUserName_Port">
<soap:address
location = "http://www.examples.com/CheckUserName/" />
</port>
</service>
</definitions>
启动代码格式:nginx安装目录地址 -c nginx配置文件地址
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
Step1:查看进程号
ps -ef|grep nginx
Step2:根据pid kill 进程
kill -QUIT 2072 //从容停止
kill -TERM 2132 或 kill -INT 2132 //快速停止
pkill -9 nginx //强制停止
/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
cd /usr/local/nginx/sbin
./nginx -s reload
ps -ef|grep nginx
kill -HUP 2255
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.