2013年3月6日 星期三

JS public private static


終於有點了解 因為老是被以前學JAVA的觀念所引導
而不能接受字典式的設計

另一方面,也覺得應該用心去理解真正的public private private protected的意思

首先先來解釋我了解的javascript的 private
就是只有物件內部才可以使用。
那因為scope的限制在裡面,實作上只要在乖乖在裡面用var作宣告就好了。
自然操作範圍就會被限制在裡面。

//*******************
// private
//*******************
var basic1 = function(){
    /********************************
    private attribute
    ********************************/
    var _attr1 = 'private attr1';
    var _attr2 = 'private attr1';
    /*****************************
    private method
    *****************************/
    function _func1(){
        return "this is private method(method1)";
    }
    function _func2(param1){
        return "this is private method("+param1+")";
    }
    /*****************************
    *constructor
    *****************************/
    function constructor(){
        console.log("this is basic1 constructor.");
        console.log("*******使用private attribute and method*********");
        var var1 = _attr1;
        console.log("this is private attribute(" +var1+")");//this is private attribute(private attr1)
        var var2 = _func1();
        console.log(var2);//this is private method(method1)
            var var3 = _func2(_attr1);
            console.log(var3);//this is private method(private attr1)
            var var4 = _func2("HERE");
            console.log(var4);//this is private method(HERE)
            var var5 = _func2();
            console.log(var5);//this is private method(undefined)
    }
    constructor();
}

//*******************
// public 這個最不懂,只知道如下這樣寫,可以讓NEW來的物件可以用其成員
//*******************
var basic1 = function(){
this.attr1 = 'public attr1';
this.attr2 = 'public attr2';
/**************************
*public method
**************************/
this.method1 = function(){
return 'this is public method(method1)';
}
this.method2 = function(param1, param2){
return 'attr1='+param1+'&attr2='+param2;

}
}
//*******************
// static 靜態
//*******************
var basic1 = function(){
    basic1.sattr1 = 'public static attr1';
    alert('內部 '+basic1.sattr1);
    function cons() {
      alert('cons go '+basic1.sattr1);
    }
    cons();
};
var obj1 = new basic1();
alert(basic1.sattr1);
alert(obj1.sattr1);

2013年2月17日 星期日

2013年1月27日 星期日

20130127 出去玩嚕~



===行程===

第一天
9:00 楊梅出發
11:00 100號牧場(2.0 H)
13:30 后豐鐵馬道(2.0H)
17:00 高美濕地
19:00 望高寮
20:30 逢甲夜市
住宿 ()

第二天
9:00 起床
10:00 綠園道
12:00 泰小間
13:30 宮原眼科
15:00 彩虹眷村
有點小異動



檢視較大的地圖

2013年1月23日 星期三

清單

JSON
XML
JSONP
RESTFUL
REST-LIKE
RPC SOAP
EVENT POOL
ORACLE-PL/SQL
MYSQL
HTTP
HTTPS
FTP
FTPS
FTPES
OOP-PHP
OOP-JAVASCRIPT

2012年9月20日 星期四

xampp phpmyadmin 登不進去 forbidden 403

已經第二次為這個事情傷腦筋了 馬上記錄下來。 C:\xampp\apache\conf\extra 這個路徑裡面的httpd-xampp.conf這個檔案要改

    Order deny,allow
    #Deny from all
    #Allow from ::1 127.0.0.0/8 
    Allow from all 
    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var

2012年7月4日 星期三

基隆行

黃金博物園區 黃金瀑布 忘憂谷 基隆廟口

2012年6月25日 星期一

mysql dateformat

轉載 http://kevyu.blogspot.tw/2011/03/mysql-datetime-format.html
魚乾的筆記本

mysql datetime format

  • 常用格式
    • 2011-03-28
      DATE_FORMAT(NOW(), '%Y-%m-%d');
  • DATE_FORMAT(date,format)

%M 月名字(January……December)
%W 星期名字(Sunday……Saturday)
%D 有英語前綴的月份的日期(1st, 2nd, 3rd, 等等。)
%Y 年, 數字, 4 位
%y 年, 數字, 2 位
%a 縮寫的星期名字(Sun……Sat)
%d 月份中的天數, 數字(00……31)
%e 月份中的天數, 數字(0……31)
%m 月, 數字(01……12)
%c 月, 數字(1……12)
%b 縮寫的月份名字(Jan……Dec)
%j 一年中的天數(001……366)
%H 小時(00……23)
%k 小時(0……23)
%h 小時(01……12)
%I 小時(01……12)
%l 小時(1……12)
%i 分鐘, 數字(00……59)
%r 時間,12 小時(hh:mm:ss [AP]M)
%T 時間,24 小時(hh:mm:ss)
%S 秒(00……59)
%s 秒(00……59)
%p AM或PM
%w 一個星期中的天數(0=Sunday ……6=Saturday )
%U 星期(0……52), 這裡星期天是星期的第一天
%u 星期(0……52), 這裡星期一是星期的第一天
%% 一個文字「%」。

2012年6月21日 星期四

bbclone

請參照石頭大這個篇文章
http://blog.markplace.net/marks_development_blog/2/2005/05/07/5

大致上就是去把bbclone整個資料夾載下來放到網頁根目錄
然後在系統每頁都會載入的檔案


define("_BBC_PAGE_NAME", "Test");
define("_BBCLONE_DIR", "../../bbclone/");  //這裡路徑自己要設定對
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

這樣子就算安裝好了@_@
然後到bbclone資料夾裡面產生
.htaccess
檔案內容

AuthUserFile C:\xampp\htdocs\bbclone\.htpasswd  #密碼的路徑
AuthType Basic
AuthName "Please Login"
Require valid-user


.htpasswd
檔案內容
帳號:密碼
這兩個檔案