AppceleratorStudio – Memory Leaks

Memory Leak
http://docs.appcelerator.com/platform/latest/#!/guide/Managing_Memory_and_Finding_Leaks

教學

  • http://www.tidev.io/2014/03/27/memory-management/
  • http://blog.sina.com.cn/s/blog_62f189570101cows.html

如何檢查
http://www.lis186.com/posts/7640

原則

  • Don’t use global variables. If you think you need global variables, think again. Always use ‘var’ when declaring variables (they’re globals if you don’t).
  • Don’t create references to objects (use anonymous object instantiated inline). If you do create references, null them out when you’re done with them.
  • Encapsulate view creation in commonJS modules, which can be instantiated and then deallocated later. (Alloy helps with this because it is commonJS by default and a lot of older hand-rolled Classic code was not).
  • Destroy collections ($.destroy()) when using view/model binding & you’re done with the associated view
  • Don’t use, and watch out for implicitly-created closures unless you know what you’re doing and later deallocate those objects.
  • Set global event listeners (Ti.App.addEventListener, Ti.Geolocation.addEventListener, etc.) with care – in your top-level controller, remove as soon as you can, never more than once, etc.
  • Learn JavaScript. It’s not Java, C#, Ruby, etc. It works the way it works so be all zen-like and accept it. Learn about scoping, hoisting, prototypal inheritance, closures, etc. Yeah, it’s a lot to learn. But you’re a developer, you can do it.

 

Alloy

  • http://www.jamesdraper.info/blog/titanium-alloy-memory-tips

自製 tiles source – 使用 Geo-OSM-Tiles

  1. 安裝 Geo-OSM-Tiles-0.04
    wget http://search.cpan.org/CPAN/authors/id/R/RO/ROTKRAUT/Geo-OSM-Tiles-0.04.tar.gz
    tar -xf Geo-OSM-Tiles-0.04.tar.gz
    cd Geo-OSM-Tiles-0.04
  2. 安裝 LWP (LWP是一個Perl的 moudle)
    
yum install perl-libwww-perl
    perl Makefile.PL
    
make
    
make test
    
make install
  3. 到 http://www.openstreetmap.org/ 選取要的地圖範圍,記下經緯度
  4. 使用 downloadosmtiles.pl 下載所需的地圖,詳見官方說明 http://search.cpan.org/~rotkraut/Geo-OSM-Tiles-0.02/downloadosmtiles.pl
ex.
    downloadosmtiles.pl --lat=31.104:31.343 --lon=121.309:121.664 --zoom=13:18 --destdir=../Map_Shanghai

 

壓縮處理 Imagemagick

convert -strip -interlace Plane -quality 50% source.jpg result.jpg

-strip 移除圖片相關的註解或資訊
-interlace 隔行掃描 Plane 漸進式

 

Cocos2d-JS 相關資源雜記

申請 TexturePacker 免費 license
https://www.codeandweb.com/request-free-license
在Blog 貼上認證碼,例如下方,你會有一個你自己的認證碼,等待認證後通知即可
TP:EABA699F

Sprite 生成的幾個方式
http://blog.csdn.net/w337198302/article/details/11874261

定時器
http://shahdza.blog.51cto.com/2410787/1542014

對象緩衝池
http://www.cocos.com/doc/article/index?type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/html5/v3/cc-pool/zh.md

粒子系統
http://www.cocos.com/doc/article/index?type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/native/v3/particle-system/zh.md

粒子系統線上編輯器
http://particle2dx.com/

粒子編輯軟體 – Particle Designer

3D粒子
http://www.cocos.com/doc/tutorial/show?id=2273
http://www.cocoachina.com/bbs/read.php?tid-293612.html

骨骼動畫編輯工具 Spine

拖尾效果教學
http://shahdza.blog.51cto.com/2410787/1611117

SpriteSheet 軟體 – TexturePacker
http://www.cnblogs.com/andyque/archive/2011/03/18/1988097.html

客制化loading畫面
http://www.xuebuyuan.com/2211852.html

Nginx 安裝SSL憑證

沃通免費SSL憑證申請
參考網址:https://45so.org/free-ssl.45so

Centos

安裝openssl

# yum install mod_ssl openssl

建立存放憑證資料夾,然後把申請到的2個憑證檔放入

# mkdir /etc/nginx/ssl

編輯虛擬主機設定檔

# vim /etc/nginx/conf.d/vhosts/test.abc.com.conf
加入
server {
#SSL
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/1_test.abc.com_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/2_test.abc.com.key;

重啟動

/etc/init.d/nginx restart

修改防火牆開放Port 443

完成