Discuz ~ 發佈新文章未即時顯示

這是因為緩存的問題...........

進後台

全局 -> 性能優化 -> 內存優化

我把主題相關的勾都拿掉.......確實是有working

Javascript ~ format numbers as money

Number.prototype.formatMoney = function(c, d, t){
var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
   return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
 };


(123456789.12345).formatMoney(2, '.', ',');

source
http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript

Yii ~ use CKEditor

到這裡下載ckeditor-integration
http://www.yiiframework.com/extension/ckeditor-integration/

解壓縮丟到extensions裡

然後下載ckeditor丟到root

http://ckeditor.com/download

像我就是丟到yii/xxxxx/底下


在View裡面使用ckeditor的sample code

$this -> widget('ext.ckeditor.CKEditorWidget', array("model" => new Event,
"attribute" => 'content',
"defaultValue" => $item['content'],
"config" => array("height" => "400px", "width" => "80%", "toolbar" => "Full")));

Yii ~ use Upload class

想當初做網站處理圖片的部分

我都是包Upload這個class來做圖片的處理

http://www.verot.net/php_class_upload_docs.htm

現在用yii的framework

想不到也可以用Photobucket


這邊下載
http://www.yiiframework.com/extension/upload/

安裝方法就是整包丟進extension

然後這邊是我的sample code

        Yii::import('application.extensions.upload.Upload');
        // receive file from post
        if (isset($_FILES['pic'])) {
            $Upload = new Upload($_FILES['pic']);

            $Upload -> jpeg_quality = 100;
            $Upload -> no_script = false;
            $Upload -> image_resize = true;
            $Upload -> image_x = 700;
            $Upload -> image_y = 500;
            $Upload -> image_ratio = true;

            // some vars
            $destPath = Yii::app() -> getBasePath() . '/../img/origin/' . $this -> id . '/';
            $destName = $item -> id;

            // verify if was uploaded
            //origin img
            if ($Upload -> uploaded) {
                $Upload -> file_new_name_body = $item -> id;
                $Upload -> file_new_name_ext = 'png';
                $Upload -> file_auto_rename = false;
                $Upload -> file_overwrite = true;
                $Upload -> process($destPath);
            }
            //thumb
            $destPath = Yii::app() -> getBasePath() . '/../img/thumb/' . $this -> id . '/';
            if ($Upload -> uploaded) {
                $Upload -> file_new_name_body = $item -> id;
                $Upload -> file_new_name_ext = 'png';
                $Upload -> file_auto_rename = false;
                $Upload -> file_overwrite = true;
                $Upload -> image_resize = true;
                $Upload -> image_x = 120;
                $Upload -> image_y = 180;
                $Upload -> image_ratio = true;
                $Upload -> process($destPath);
            }

        }


Yii ~ load config

'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster@example.com',
'myParam'=>'myValue',
),


$param=Yii::app()->params['myParam'];


reference
http://www.yiiframework.com/forum/index.php/topic/10559-how-to-load-configuration-set-in-configmainphp/

Javascript ~ get json key value

for (var key in p) {
if (p.hasOwnProperty(key)) {
alert(key + " -> " + p[key]);
}
}



reference
http://stackoverflow.com/questions/684672/loop-through-javascript-object

MilkShape3D


http://www.wretch.cc/blog/gtaiv/8547734

3dsmax ~ another way to export md2, export to MilkShape3D ms3d

上網找的輸出md2的script.....

輸出的東西似乎都不能用......打不開= =

所以才找到這東西

作法就是先輸出成,ms3d給MilkShape3D

再從MilkShape3D開啟再輸出md2

關於3dsmax輸出ms3d

到這邊下載
http://www.maxplugins.de/r2009_files/collberg/max2ms3d_v112_Max2009.zip

解壓縮放到3dsmax裡的plugins目錄

開啟3dsmax就可以輸出ms3d檔了




reference
http://forums.cgsociety.org/archive/index.php/t-721754.html

3dsmax ~ import md2

到此連結下載plugin

http://www.scriptspot.com/3ds-max/scripts/quake-ii-md2-importer

下載後解壓縮

把importmd2.ms貼到Script裡的startup目錄

像我是
C:\Program Files\Autodesk\3ds Max 2009\Scripts\Startup

丟進去開啟3dsmax

進Utilities

點MAXScript


選Quake2 MD2 Importer

Load all frames打勾

在按Import MD2就可以匯入到3dsmax裡




3dsmax ~ Keys may not be set when in figure mode. exit figure mode


這是移動骨架並設定key時發生的問題

離開figure mode

點motion的tab

選骨架

把Figure Mode按掉就好



reference
http://forums.3dtotal.com/showthread.php?t=82892