一. 核心
  1.  三大類型型別
  2.  數字型別
  3.  6個被判斷為false的值 
  4.  6種type
  5.  null vs. undefined vs. xx is not defined的差別

minglight 發表在 痞客邦 留言(0) 人氣()

想要用setTimeout來使用delay call loop, 但是參考W3School卻沒有地方可以呼叫參數!!
直接參考Closure, http://minglight.pixnet.net/blog/post/43019938
 

minglight 發表在 痞客邦 留言(0) 人氣()


這篇文章主要是follow GWT的Tutorial來介紹GWT.  
參考Google文件 : https://developers.google.com/web-toolkit/doc/latest/tutorial/
GWT Overview
GWT是給Java developer能夠在寫Web App的時候能夠盡量不使用到Javascript,讓Web client端的程式碼也可以用Java的程式,利用GWT的Complier將Java編譯成Javascript code,而且還能夠相容於各個瀏覽器,這正是GWT最重要的目的。
GWT Client支援的JRE - 參考Google  https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation

minglight 發表在 痞客邦 留言(2) 人氣()

escape(),encodeURI() vs encodeURIComponent() 這三種都拿來當做編碼用,但仍然有一些小差別,目前主要還是用encodeURI() & encodeURIComponent()比較好
編碼-

escape():
ISO的ASCII系統,只要不是0-9,a-z,A-Z的都會被編碼成16進位的Unicode.
不編碼的符號包括: @*/+
缺點: 遇到UTF8可能會出錯,
 
encodeURI():
用 encodeURI() 會比使用 escape() 轉換 URI 正確。
不編碼的符號包括: ~!@#$&*()=:/,;?+'
注意 : 不處理 單引號,&,等等....要注意 

minglight 發表在 痞客邦 留言(0) 人氣()

MSDN Link : 
http://msdn.microsoft.com/en-us/library/ms524602(VS.85).aspx

minglight 發表在 痞客邦 留言(0) 人氣()


Step1. 複製Mail list from sendTo....to Notepad++
Will get a string like this
XX, XX X<xxx.xxxx@intel.com>
 
Step2. 操作Notepad++
在Notepad++按下 [Ctrl+F] ,在介面左下方選取用類型表式(E)
在尋找目標欄位中放入 >;[A-Za-z,'\s]+<
取代成  ;
會得到
xxx.xxxx.intel.com
去頭去尾之後就是Email List了
 

minglight 發表在 痞客邦 留言(0) 人氣()

如果你想要當mouse over時變更cursor, css中有一個屬性是cursor, 當使用此屬性時即可達到你想要的目的.
EX: <input name="acct" style="cursor:progress"/>
但如果你想要的效果是,類似處理中請稍候,其實道理一樣,只是cursor的範圍改成body即可
EX: 

minglight 發表在 痞客邦 留言(0) 人氣()

http://spservices.codeplex.com

minglight 發表在 痞客邦 留言(0) 人氣()

Variables

ParameterValue


HttpHost
URL of the Web server.


Language
LCID of the language used on the site, for example 1033 for an English-language site.


ImagesPath
URL of the images path, in the context of the current Web site, for example: http://server/sites/test/_layouts/images/


HttpPath
URL of the path to the appropriate owssvr.dll file in the context of the current Web site. For example, http://server/sites/test/_vti_bin/owssvr.dll?CS=109, where CS=109 means that the UTF-8 character set is used for all communication to owssvr.dll.


HttpVDir
Root directory of the current subsite. For example, for the page http://server/sites/test/default.aspx, the value is http://server/sites/test/.


PageUrl
The URL of the currently requested page. For example, http://server/sites/test/default.aspx.


Project
The site-relative URL of the root folder of a list, if the current page request is in the context of a list. This is the name of the folder that contains all the files used in working with the list, for example, Lists/Announcements.


View
{GUID}. If the Web Part is a view of a list, this is the view identifier.


ListProperty_TemplateUrl
When the current page request is in the context of a list, and the list is a document library, this is the URL of the template document for this document library.


ListUrlDir_FALSE
When the current page request is in the context of a list, this is the complete URL to the root folder of the list, for example, http://server/sites/test/Lists/Announcements.


ListUrlDir_TRUE
When the current page request is in the context of a list, this is the site-relative URL of the root folder of the list. (This is the same as parameter Project).


URL_New, URL_NEW
When the current page request is in the context of a list, this is the URL to the page for creating a new item in the list (newform).


URL_Edit, URL_EDIT
When the current page request is in the context of a list, this is the URL to the page for editing an existing item in the list (editform).


URL_Display,URL_DISPLAY
When the current page request is in the context of a list, this is the URL to the page containing the default vi

minglight 發表在 痞客邦 留言(0) 人氣()

為了不誤導大家,把一些看完Source的進階心得寫在這兒
1. 把Map<Thread,value>放在ThreadLocal的缺點
    在某些情況下Thread不會重複使用. 例如Web環境,Container會產生一個新的Thread來處理Request-Response,因此如果ThreadLocal設計方式是ThreadLocal-簡介,將Map放在ThreadLocal中,你會發現這個Map越來越大,越來越大,要直到你重開Server才會重置 ( 以上純屬個人推論 XD )
2. ThreadLocal實際運作方式
    ThreadLocal並不會自己存放Map,而是把Map放到Thread裡面去!!
    Thread中會有一個ThreadLocalMap<ThreadLocal,Object> ,注意這邊的Key變成了ThreadLocal物件本身, 因此每個ThreadLocalMap都有可能會有以不同的ThreadLocal相對應的值.
    其實這種方式更直覺,每個Thread會有一個空間放一些客製的變數,而且好處是,當Thread掛掉之後,這個Map也會跟著Thread被GC掉.
3. ThreadLocal的API
    protected T initialValue() 
給繼承者使用, 預設回傳null, 當呼叫get()拿到null時會呼叫initialValue()將值擺進去.
    其他直覺的使用如下
     +get() : T 
     +set(T) : void     
     +remove(T) : void 
4. 使用ThreadLocal的時機
    我查了一下網路,有人說當你對一個bean/resource使用synchronized的時候,常常是寫法不易而且效能不彰(因為Thread都在排隊等放飯).因此ThreadLocal可以拿來取代synchronized
    這種說法是部分正確的. 其道理在於如果你今天只有一個飯鍋, 放飯的時間一定會拉很長,如果使用ThreadLocal, 當你需要吃的時候我直接給你一碗飯,這時候就不需要排隊了.
   
    ThreadLocal的觀念就是個人造業個人擔,不管你要對你的飯做什麼都不會影響到別人
    但是synchronized內的邏輯,因為是大家共用一個飯鍋,當輪到你盛飯的時候,如果你在飯鍋裡面加了滷肉,整鍋飯就會變成魯肉飯了.
    因此ThreadLocal可以取代synchronized的時機只有在於沒有人會對飯動手腳的時候才適用.
       
    可以把它當作requestScope的延伸
    這個就不需要太多解釋了,因為跟request在同一個Thread裡面 

minglight 發表在 痞客邦 留言(0) 人氣()

前置觀念 - 必須了解Thread, Thread.currentThread()被呼叫的機制, call stack機制.
ThreadLocal的目的 : 把變數存在currentThread中, 讓每個執行中的Thread都有自己的一份Copy, 而且彼此之間不會互相影響.
實作概念 : 
public class ThreadLocalConcept{
private Map<Thread,Object> localMap = Collections.synchronizedMap(new HashMap<Thread,Object>());
public void set(Object obj){
this.localMap.put(Thread.currentThread(), obj);
}
public Object get(){
this.localMap.get(Thread.currentThread());
}

基本上就是這個localMap會放著各個Thread對應的變數, 因此在不同的Thread中呼叫到的Value都會是獨立的.
用途範例 : 在DAO中拿到Login User
     
一般來說Login User都是放在Session中, 但是平常我們使用的Service & DAO都會是Singleton, 是共用的, 因此不能夠將Login User放入
        
我們可以利用一個Request-Response是一個獨立Thread的特性, 搭配ThreadLocal將Login User存入各個Thread中,就可以拿到相對應的Login User了

minglight 發表在 痞客邦 留言(2) 人氣()

純粹分享學習心得,並不會有系統的介紹Javascript,我的JS經驗也很粗淺,如果有寫錯或是遺漏也請不吝指教
另外參考良葛格學習筆記就可以得到完整版本的教學了
1. null vs undefined vs not defined error
    null代表null物件
        除非手動assign一個參考為null,不然參考不會出現null值
    undefined有兩種情形
        a. 是一個參考的預設值,宣告一個變數而不assign時,其值就會是undefined (function的參數被呼叫時沒有被給值也算是這種情形)
        b. 呼叫物件不存在的屬性也會得到undefined值
    
    not defined error
        如果使用一個沒有宣告過的變數,就會得到錯誤(xx is not defined) -- 程式中斷

2. 條件判斷式
         在JS中判斷式有六種情形會被判定為false,其餘的情形都是true
         false的情形有 : false , 0 , null , undefined , "" , NaN
         PS.在PHP中, "0"也會被判定為false,是比較特別的情形
3. 利用typeof時如何分辨object vs function 
         可以想成instance vs  class的分別,另外null的type是object,是比較特殊的情形
4. global變數其實就是window物件的屬性,而global中的this指的就是window物件

minglight 發表在 痞客邦 留言(0) 人氣()

« 1 2 3
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。