2015年2月10日 星期二

[Java] Get Class Name

Class<?> enclosingClass = getClass().getEnclosingClass();
if (enclosingClass != null) {
  System.out.println(enclosingClass.getName()); // the declaring class name
} else {
  System.out.println(getClass().getName()); // this class is anonymous
}

Or,

String className = this.getClass().getSimpleName(); // if this is not 
//an anonymous class, else return ""

http://stackoverflow.com/questions/6271417/java-get-the-current-class-name

[jQuery] Select More than One Element by Index Using .eq()

e.g

$('td', row).eq(0).addClass('strong text-info');
$('td', row).eq(1).addClass('strong text-info');

To combine the above as one line, add a jQuery plugin through (place anywhere in $(document).ready before using):
$.fn.eqAnyOf = function (arrayOfIndexes) {
    return this.filter(function(i) {
        return $.inArray(i, arrayOfIndexes) > -1;
    });
};
Then use the below codes:

$('td', row).eqAnyOf([0,1]).addClass('strong text-info');

http://tiku.io/questions/581385/use-jquery-to-select-multiple-elements-with-eq

分數不是終點

  分數只是學習旅程中的一個階段性記號, 絕對不是人生的終點 。 [ 1 , 2 ] 為什麼分數不是終點? 分數是起點而不是結果 :考試與成績單是用來檢視學習盲點的工具,而不是用來定義一個人價值的最後審判。 能力比高分更持久 :高分或許能敲開某扇門,但真正能讓人走得長遠的,是面...