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://代理

python性能优化

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

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

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


编译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

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.