Call C/C++ from Java and call Java from C/C++
http://87showmin.blogspot.tw/2009/06/java-java-native-interfacejni.html
http://www.codeproject.com/Articles/993067/Calling-Java-from-Cplusplus-with-JNI
A place to record somethings related to programming.
Call C/C++ from Java and call Java from C/C++
http://87showmin.blogspot.tw/2009/06/java-java-native-interfacejni.html
http://www.codeproject.com/Articles/993067/Calling-Java-from-Cplusplus-with-JNI
http://my.phirobot.com/blog/2014-02-opencv_configuration_in_vs.html
https://github.com/jackklpan/visual_studio_config
Production:
forever
pm2
From Tonyq(https://www.facebook.com/tonylovejava/posts/10206912577918652?fref=nf)
有設定的話剛 clone 別人專案回來時,可以用 “npm install” 直接安裝專案相依性到 local 。好處是不用把 node_modules commit 進版本控制,降低大小跟環境依賴。
npm init 是如果沒有 package.json 可以用這個快速產生一個。
npm install <package> //正常的安裝套件流程
如果沒有指定 package 的話,會自動安裝 package.json 裡面的相依性.
但如果你是裝專案需要的 npm package 的話,可以加上 “–save” ,如 npm install <package> –save ,會順便更新 package.json 檔加入這個 dependency。
如果你是給 gulp 或其他開發工具用的,可以用 –save-dev ,會寫入 dev-dependency 區。
另外跟這個沒有直接關係,但值得知道的事情是 “-g” 屬性,有支援 npm install -g <package> 的 npm ,會把該 package 直接變成 global 的 command。像是 express /browserify 等等等。(windows 底下這個功能有點 buggy …)
==
發現我漏講了 npm run
在 package.json 裡面有 scripts properties 。可以在裡面直接寫入你要執行的 “command line”(!!) 指令
像是我手上這專案是這樣
“scripts”: {
“test”: “echo \”Error: no test specified\” && exit 1”,
“dev”: “supervisor –extensions ‘node,js,jsx’ app.js”
},
就可以透過 npm run dev 來執行「supervisor –extensions ‘node,js,jsx’ app.js」
npm install <package> 如果不帶上 –save 或 –save-dev 的話,所安裝的 package 將不會自動記進 package.json。
但是,這些模塊仍會安裝在你的 node_modules。這時候你可以透過 npm prune 命令,清除這些不在 package.json 裡的模塊。
這有時候在調試時,這還滿好用的。
PS: bower prune 也有同樣功能。
From 陳樂子 in (https://www.facebook.com/groups/javascript.tw/permalink/628502737251068/)
npm install <package> -g 即是 –global,會把你的模塊裝到全局裡去,只要是在這個 node 環境下,所有項目都會共用著這些模塊,例如 npm gulp bower mocha 通常都是這樣使用。
你 npm install mocha -g,安裝完成後,你便可以直接在任何地方執行 mocha –check-leaks –reporter spec 之類的命令。
若你不想每次都要污染全局,你依然可以僅安裝在本地項目目錄上,只是若你要調試的話,便變成在要給模塊指定一個路徑,例如 node_modules/mocha/bin/mocha –check-leaks –reporter spec。
你也可以透過 package.json 的 scripts 預先來編好一些腳本,再透過 npm run <command> 來執行。透過 npm run 執行的腳本,所有安裝在本地的模塊,皆不再須要幫它編寫路徑。
因此你可以直接這樣作
$ npm install npm-dep-info
// package.json
“scripts”: {
“info”: “npm-dep-info”
}
$ npm run info
附帶一提,我命令都是用縮寫比較快。
例如
npm i 取代 npm install
npm un 取代 npm uninstall
npm i -S 取代 npm install –save
npm i -D 取代 npm install –save-dev
FlannBasedMatcher is a approximate matcher, and in my opinion it is depend on some random number.
Therefore if the execution sequence is the same, the result will be same.
However, this will lead to the result that when the same thing do twice, the result will not be the same.
So if we want to guarantee the result will be same no matter do it at any time, we should use BFMatcher.
The postgis function ST_GeomFromGeoJSON sometimes cause database crash.
http://dba.stackexchange.com/questions/83264/st-geomfromgeojson-causes-postgres-to-crash
http://trac.osgeo.org/postgis/ticket/3002
And I cannot find any solution for it.
Therefore, I do it workaround.
I convert the geojson to kml and then use ST_GeomFromKML.
https://github.com/mapbox/tokml
var kml = tokml(geojson.geometry);
//left only the geometry part
kml = kml.replace(‘<?xml version=”1.0” encoding=”UTF-8”?><kml xmlns=”http://www.opengis.net/kml/2.2"><Document><Placemark><ExtendedData></ExtendedData>’, “”).replace(“</Placemark></Document></kml>”, “”);
http://www.w3schools.com/sql/default.asp
prevent sql injection:
http://fecbob.pixnet.net/blog/post/39095519-%E9%A0%90%E9%98%B2sql%E6%B3%A8%E5%85%A5%E6%94%BB%E6%93%8A
In summary:
1. Use Parameterized Query
2. Data validation for integer and date…etc.
3. Replace the ‘ to ‘’ ( Replace(“‘“, “‘’”) ) for string type.
4. Use appropriate user role to connect database.
POSTGIS:
http://revenant.ca/www/postgis/workshop/indexing.html
http://workshops.boundlessgeo.com/postgis-intro/
ST_GeomFromGeoJSON => connection terminated, because this function cause database crash!
http://dba.stackexchange.com/questions/83264/st-geomfromgeojson-causes-postgres-to-crash
and I cannot find any solution to this.
VACUUM ANALYZE CLUSTER
DB size:
SELECT pg_size_pretty(pg_database_size(‘dbname’));
Table size:
SELECT pg_size_pretty(pg_total_relation_size(‘cities_region’));
Top 10 size:
SELECT relname AS “relation”, pg_size_pretty(pg_relation_size(C.oid)) AS “size”
FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN (‘pg_catalog’, ‘information_schema’)
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 10;
https://umur.io/angularjs-directives-using-isolated-scope-with-attributes/
directives should use ‘-‘ to replace camel case variable in scope and directives name
for example:
scope: {
aExample: “=”
}
is
a-example when use
TileMill
openlayer
geoserver mapserver
mapnik
http://cicero.azavea.com/docs/epsg_codes.html
http://www.wangwei.info/2014/09/osmgis-planet-data-import/
https://developers.google.com/maps/documentation/javascript/examples/maptype-image
http://live.osgeo.org/zh/overview/overview.html
http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
https://gist.github.com/tmcw/4954720
TileMill
https://github.com/mapbox/mbutil
https://developers.google.com/maps/documentation/javascript/examples/maptype-overlay
https://github.com/bmcbride/PHP-MBTiles-Server
create php apache server
http://www.jaceju.net/blog/archives/703/
and in windows
extension_dir = “D:/Program Files (x86)/php_5/ext” (http://stackoverflow.com/questions/7086859/pdo-drivers-no-value-in-windows)
http://www.linkplugapp.com/a/224929#http://www.garbl.es/angularjs/preload/2014/06/07/frictionless-data-preloading-in-angularjs/
http://codeutopia.net/blog/2013/05/27/3-ways-to-get-backend-data-to-angularjs/
http://www.mircozeiss.com/how-to-pass-javascript-variables-from-a-server-to-angular/ (3rd way is bad.)
https://docs.angularjs.org/guide/module
http://lostechies.com/gabrielschenker/2014/01/14/angularjspart-9-values-and-constants/