2019年9月25日星期三

用shadowsocks加速git clone

用shadowsocks加速git clone

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

shadowsocks的本地端口默认是1080

上面设置只是开启https://代理

2019年9月17日星期二

List tables in a PostgreSQL schema

List tables in a PostgreSQL schema

python性能优化

0、使用 line_profiler 逐行分析性能瓶颈。

1、如果内存够用,使用file对象的readlines一次性读入,再分析。

2、输出时,使用  io.StringIO()  缓存后,再一次性输出到文件。


2019年9月16日星期一

10 Easy Steps to a Complete Understanding of SQL

10 Easy Steps to a Complete Understanding of SQL

深入理解SQL的十个步骤

https://postgis.net/workshops/postgis-intro/joins.html

编译openmesh

C:\aka\OpenMesh-8.0\build\Unittests>g++   -o unittests unittests.cc -I"C:\aka\googletest-master\googletest\include" -I"C:\aka\OpenMesh-8.0\build" -I"C:\aka\OpenMesh-8.0\src"  -L"C:\aka\googletest-master\build_googletest\bin"    -lgtest

g++   -o attributes attributes.cc  -I"C:\aka\OpenMesh-8.0\build" -I"C:\aka\OpenMesh-8.0\src"  -L"C:\aka\OpenMesh-8.0\build\src\OpenMesh\Core"    -lOpenMeshCored


Compiling OpenMesh with mingw and cmake on windows

googletest

creating-using-shared-libraries-different-compilers-different-operating-systems/

Creating a shared and static library with the gnu compiler (gcc)

undefined-reference-to-stdios-baseinitinit


2019年9月15日星期日

convert Jupyter(.ipynb) to Python(.py)

https://nbconvert.readthedocs.io

jupyter nbconvert --to script mike21fm_mesh_openmesh_to_shape.ipynb

2019年9月10日星期二

PostgreSQL Temporary Table

PostgreSQL Temporary Table

PL/pgSQL Errors and Messages

PL/pgSQL Variables

Postgres FOR LOOP

dynamic sql query in postgres

String Functions and Operators

PostgreSQL: Dynamic SQL Function

PostgreSQL: Dynamic SQL Function

CREATE TEMP TABLE "千河套__西防洪堤以西2" As  SELECT  sjx.*    from xqh_v_sjx as sjx , xqh_v_zones as v_zone   where ST_Within(sjx.geom,v_zone.geom)  AND v_zone.zone_name =  '千河套__西防洪堤以西' ;


DO 
$$
DECLARE
zone_name1 text;
BEGIN
FOR zone_name1 IN SELECT zones.zone_name 
FROM xqh_v_zones as zones 
WHERE zones.zone_name <> '待删除区域' 
LOOP
--RAISE NOTICE '%', zone_name1;
EXECUTE  format('CREATE TEMP TABLE %s AS SELECT  sjx.*   from xqh_v_sjx as sjx , xqh_v_zones as v_zone  where ST_Within(sjx.geom,v_zone.geom)  AND v_zone.zone_name =  %L',quote_ident(zone_name1),zone_name1);
--EXECUTE 'CREATE TEMP TABLE "'  || zone_name1  || '" As '  || ' SELECT  *   ' || ' from xqh_v_sjx as sjx , xqh_v_zones as v_zone  ' || ' where ST_Within(sjx.geom,v_zone.geom)  AND v_zone.zone_name =  ' || zone_name1 || ' ;' ;
END LOOP;
END;
$$;

postgreSQL 中 SELECT INTO 与 CREATE TABLE AS 的区别

http://www.postgresqltutorial.com/postgresql-select-into/

Note that you cannot use the SELECT INTO statement in PL/pgSQL or ECPG because they interpret the INTO clause differently. In this case, you can use the CREATE TABLE AS statement which provides more functionality than the SELECT INTO statement.

postgreSQL中单引号、双引号的区别

What is the difference between single quotes and double quotes in PostgreSQL?