1. 程式人生 > >Jerry Wang的SAP工作日誌 - 2016年1月

Jerry Wang的SAP工作日誌 - 2016年1月

2016-01-02

perform build_lc_user_stat
防窺膜101556973
Your ticket has been successfully sent. TicketID: 800109225
小魚1 - 拼好的面朝自己
小魚2 - 拼好的面朝右邊。
逆時針三輪換:小魚1+整個魔方轉180度+小魚2
順時針三輪換: 小魚2+整個魔方轉180度+小魚1
小魚1頂層一直在做逆時針旋轉

2015-1-3

  1. 9:11AM開始quiz 50.
class type2{
}
(new Type2() instanceof String)
Type3 t3 = (
Type3) new Object(); class Point51 { protected final int x, y; private final String name; // cached at construction time Point51( int x, int y){ this.x = x; this.y = y; name = makeName(); } protected String makeName() { return "[" + x + "," + y + "]";
} public final String toString() { return name; } } public class ColorPoint extends Point51 { private final String color; ColorPoint( int x, int y, String color){ super(x,y); this.color = color; } protected String makeName(){ return
super.makeName() + ":" + color; } public static void main(String[] args) { System.out.println(new ColorPoint51(4,2, "Purple"));

在一個final型別的例項域被賦值之前,存在著取勇其值的可能性。此時它包含的仍舊是所屬型別的預設值。只要一個構造器呼叫了一個已經被子類覆寫了的方法,就會出問題,因為這種方式被呼叫的方法總是在例項被初始化之前執行。不要在構造器中呼叫可覆寫的方法。

static {
  initializeIfNecessary();
}
private static int sum;
public static int getSum(){
   initializeIfNecessary();
   return sum;
}
private static boolean initialized = false;
private static void initializedIfNecessary() {
   if( !initialized){
      for( int i = 0; i < 100; i++)
         sum += i;
      initialized = true;
   }
 }
}

Cache類有兩個靜態初始器,頂端的一個static語句塊,以及靜態域initialized的初始化。
如果初始化代價較高,或者該域在某些執行中不會被用到,那麼惰性初始化適用。

private static final int sum1 = computeSum();
class Thing{
     public Thing(int i ){ }
}
private final int arg;
public Thing53(){
  super(arg = 1);
}
Alternate constructor invocation - Private Constructor Capture
class Null54 {
  public static void hello(){
      System.out.println("hello");
  }
}

在靜態方法呼叫中,適用表示式作為其限定符不是好主意。表示式的值所引用的物件的執行期型別在確定哪一個方法被呼叫時不起任何作用。靜態方法呼叫的限定表示式是可以計算的,但是值將被忽略,沒有任何要求其值為空的限制。
Java不允許一個本地變數宣告語句作為一條語句在for,while或do 迴圈中重複執行。只能直接出現在一個語句塊中。

AtomicLong numCreated = new AtomicLong();
}
BigInteger fivek = new BigInteger("5000");
BigInteger total = fivek.add(new 
int vals[] = {789,678,567,456,345,234,123,012};
Set diffs = new HashSet();
for( int i = 0; i < vals.length; i++)
   for( int j = i; j < vals.length; j++) 
      diffs.add(vals[i] - vals[j]);
System.out.println(diffs.size());
Thread.currentThread().interrupt();
if( Thread.interrupted()){
   System.out.println("Status:" + Thread.interrupted());
}
public class85 {
  private static boolean initialized = false;
  static {
      Thread t = new Thread(new Runnable(){
           public void run(){
              initialized = true;
          } 
       });
   t.start();
   try{
     t.join();
   } catch(InterruptedException e){
     throw new AssertionError(e);
      }
}
System.out.println(initialized);

當一個執行緒訪問一個類的某個成員時,它會檢查這個類是否已經被初始化。有4種可能:

  1. 該類尚未被初始化
  2. 該類正在被當前執行緒初始化,這廝對初始化的遞迴請求。
  3. 該類正在被其他執行緒而不是當前執行緒初始化
  4. 該類已經被初始化
    後臺執行緒執行run方法,將initialized 設定為true之前,回去檢查Lazy類是否已經被初始化。這個時候,這個類正在被另外一個執行緒初始化,即情況3, 於是當前執行緒,即後臺工作執行緒會等待class物件直至初始化完成。那個正在進行初始化工作的執行緒,即主執行緒,正在等待著後臺執行緒執行結束。死鎖。
public static
private static Thread t = new Thread( new Runnable() {
     public void run(){
         initialized = true;
     }
 });
static { 
  t.start();
}
最好的辦法就是不要在類進行初始化時啟動任何後臺執行緒。或者讓主執行緒再等待後臺執行緒之前就完成類的初始化。
int型別的負數常量都是由正數十進位制字面常量前加一元負操作符-構成。

等價關係:自反,傳遞,對稱。
==不是自反。Double.NaN == Double.NaN不成立。
當比較兩個原始型別數值時,==首先進行二進位制資料型別提升 - binary numeric promotion, 會導致兩個數值中有一個會進行拓寬原始型別轉換 - widening primitive conversion. 將int或者long轉換成float,或者long轉換成double時,會導致精度丟失。
實現不可傳遞性:
選擇兩個較大的但不相同的long型數值賦給x和z,將一個與前面兩個long型數值相近的double型數值賦給y。==作用於原始型別時具有不可傳遞性。

long x = Long.MAX_VALUE;
double y = (double)Long.MAX_VALUE;
long z = Long.MAX_VALUE - 1;
System.out.println( ( x==y) + ""); // true
System.out.println( ( y==z) + ""); // true
System.out.println( ( x==z) + ""); // false
public class Pair88<T> {
   private final T first;
   private final T second;
   public Pair88(T first, T second) {
       this.first = first;
       this.second= second;
   }
   public T first() {
       return first;
   }
   public T second() {
       return second;
   }
   public List<String> stringList() {
      return Arrays.asList(String.valueOf(first), String.valueOf(second));
   
Pair p = new Pair<Object>(23, "Jerry");
   public static 
System.out.println(p.first() + " - " + p.second());
for( String s: p.stringList())
     System.out.println(s + ",");

一個原生型別就是一個沒有任何型別引數的泛型類的名字。List是泛型介面,List是引數化的型別,List是一個原生型別。一個原生型別的所有勢力成員都要被替換掉,在一個例項方法宣告中出現的每個引數化的型別都要被其對應的原生部分所取代。
變數p是屬於原生型別Pair,所以其所有例項方法都要執行這種擦除。包括宣告返回List的方法stringList. 編譯器會將這個方法解釋為返回原生型別List。
引數化型別List雖然是方法stringList的返回型別,但它與Pair88的型別引數沒有關係,事實上最後被擦除了。
每次呼叫getAnnotation方法時都會涉及到兩個Class物件。

  1. 在其上呼叫該方法的物件 - 通過反射獲得
  2. 作為傳遞引數指出需要哪個類的註解的物件 - 類名稱字面常量。

2015-01-04

  1. jQuery.sap.registerModulePath
    jQuery.sap.registerModulePath(“sap.cus.crm.lib.reuse”, sPath + “…/crm_lib_reuse/sap/cus/crm/lib/reuse”);
    If the workaround is to remove the cache busting token you added to the URL, why did you add it in the first place?
    Maybe a better solution is to remove the token from the URL until you come to a decision.
    extHookNavigateAfterCreate
CL_virus_adapter
static<E> List<E> withoutDuplicated(List<E> original) {
     return new ArrayList<E>( new LinkedHashSet<E>(original));
}
static String[] parse(String string) {
    return string.split(", \\S*");
}
Calendar cal = Calendar.getInstance();
cal.set(1999, Calendar.DECEMBER, 31);
System.out.println(cal.get(Calendar.YEAR) + " " );
System.out.println(cal.get(Calendar.DAY_OF_MONTH));
class LinkedList<E> { 
  private Node<E> head = null;
  private class Node<E> {
      E value;
      Node<E> next;
    
   Node(E value) {
      this.value = value;
      this.next = head;
      head = this;
    }
}

一個泛型類的內部類可以訪問到它的外圍類的型別引數,所以Node完全不需要有自己的型別引數。

private class Node {
   E value;

```java
   Node next;
   Node(E value) {
      this.value = value;
      this.next = head;
      head = this;
   }
}
public void add(E e){
      new Node(e);
}
public void dump() {
  for( Node n = head; n != null; n = n.next)
     System.out.println(n.value + " " );
}
LinkedList<String> list = new LinkedList<String>();
list.add("world");
list.add("hello");
list.dump();

一個非靜態的巢狀類的構造器,在編譯時會將一個隱藏的引數作為它的第一個擦數,這個引數表示了它的直接外圍例項( immediately enclosing instance). 當在程式碼中任何可以讓編譯器找到合適的外圍例項的地方去呼叫構造器時,該引數就會被隱式傳遞進去。當你使用反射呼叫構造器時,這個隱藏的引數需要被顯式地傳遞,這對於Class.newInstance是不可能做到的,只有使用java.lang.reflect.Constructor.
如果Inner例項並不需要一個外圍的例項出的話,可以將inner型別宣告為static。優先使用靜態成員類。
當你在一個泛型類中巢狀另一個泛型類時,最好為型別引數設定不同名字。
class Inner1 extends
Inner2的超類本身也是一個內部類,要想例項化一個內部類,例如Inner1,需要提供一個外部類的例項給構造器。一般情況下,它是隱式地傳遞給構造器的,但是也可以通過expression.super(args)的方式通過超類構造器呼叫顯式地傳遞。如果外部類例項是隱式傳遞的,編譯器會自動產生表示式,它使用this來指代最內部的其超類是一個成員變數的外部類。Inner2間接擴充套件了Quiz90類,Inner便是它的一個繼承而來的成員。因此,超類構造器的限定表示式直接就是this,編譯器提供外部類例項,將super重寫成this.super.

Sub sub = new Sub(666);
sub.checkInvariant();
Sub copy = (Sub) deepCopy(sub);
copy.checkInvariant();
static public Object deepCopy(Object obj) {
    try{
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray());
      return new ObjectInputStream(bin).readObject();
    } catch(Exception e) {
    }    
class Super implements Serializable { 
    final Set<Super> set = new HashSet<Super>();
}
final class Sub extends Super {
      private int id;
      public Sub(int id) {
         this.id = id;
         set.add(this);
      }
      public void checkInvariant(){
        if(!set.contains(this))
           throw new AssertionError("invariant violated");
      }
      public int hashCode(){
         return id;
      }
      public boolean equals(Object o ) {
         return ( o instanceof Sub) && ( id == ((Sub)o).id);
    }
}
new ObjectOutputStream(bos).writeObject(obj);

序列化系統會反序列化Sub例項中Super的域,即set。包含了一個隊HashSet的引用。在內部,每個HashSet例項包含一個隊HashMap的引用,HashMap的鍵是該雜湊集合的元素。HashSet有一個readObject方法,建立一個空的HashMap,並使用HashMap的put方法,針對集合中的每個元素在HashMap中插入一個鍵值對。put方法會呼叫鍵的hashCode方法以確定它所在的bucket。在我們的程式碼中,雜湊對映表中唯一的鍵就是sub的例項,而它的set域正在被反序列化。這個例項的子類域,即id,尚未被初始化, 因此值為0.而Sub的hashCode將返回這個值,而不是最後儲存在這個域中的值666.因為hashCode返回了錯誤的值,相應的鍵值對將會放入錯誤的單元格中,當隨後id被初始化成666時,一切都太遲了。

包含了HashMap的readPObject方法的序列化系統總體上違背了不能從類的構造器或者偽構造器中呼叫其可覆寫方法的guideline。
Super.readObject
-> HashSet.readObject
-> HashMap.put
->Sub.hashCode, 而sub例項正處於建立過程中,被覆寫的方法在sub域被初始化之前就被呼叫了,而該方法需要依賴於Sub的域。
如果一個HashSet,HashTable或者HashMap被序列化,必須確認其北榮沒有直接或間接地引用到它們自身。

private final String name;
Twisted92(String name) {
     this.name = name;
}
private String name() {
    return name;
}
private void reproduce() {
    new Twisted92("reproduce") {
      void printName() {
        System.out.println(name());
      }
   }.printName();
}
new Twisted92("main").reproduce();

所有的本地,內部,巢狀和匿名的類都可以毫無限制的訪問彼此成員。
name方法並沒有被繼承到reproduce方法中的匿名類中。所以,匿名類中對於printName方法的呼叫必須關聯到外圍例項main而不是當前例項reproduce。
enclosing scope:含有正確名稱的方法的最小外圍範圍。
Quiz 72: final修飾符對於方法和域而言,完全不同。對於方法,final意味著該例項方法不能被覆寫,或者靜態方法不能被隱藏。對於域,final意味著其不能被賦值超過一次,但是可以被隱藏。

Hello colleagues,
This incident is talking about Sales Order application in Fiori. However, the component CRM-FIO-BTX is only responsible for the following CRM Fiori applications:

  • CRM-FIO-BTX-APP: Activity Management
  • CRM-FIO-BTX-LEA: Lead Management
  • CRM-FIO-BTX-OPP: My Opportunities
  • CRM-FIO-BTX-TAS: Task management
    I am afraid you have put to the wrong component.

CRM-BTX-SLO
CRM_STATUS_MAINTAIN_OW

2016-01-05

  1. The test proves it’s not the Fiori Client but the UI5 interaction with the iOS WKWebView.
    Dear UI5 colleagues,
    Would you please kindly have a look at this issue? From application side we made several researches however we didn’t find any hint from application point of view. As suggested from Fiori Client team colleagues, we need your expertise here.
    For your convenience I summarized current situation as below:
  2. Customer COULD NOT reproduce this issue in their laptop via Chrome;
  3. Customer COULD reproduce this issue in their mobile device using:
    a. Fiori Client
    b. Safari browser
  4. From application side, we have told customer to switch on traces on gateway and CRM backend system ( for details please kindly refer to my reply 28.12.2015 07:25:19 Jerry Wang ), unfortunately we didn’t find any related hint for this issue.
  5. Fiori Client team colleagues suspected that it might be some problem in UI5 code interaction with iOS WKWebView (iOS8 or later).
    As this issue could not be reproduced in Chrome, would you please kindly help to find the root cause? Thanks a lot for your kind help!
    Best regards,
    Jerry

DocumentNextUserStatuses
TASKSTATUSES
TaskStatus
DOCUMENTNEXTUSERSTATUSES
are/?id=2c828f8c88b6914996e308a3dff59d40&type=note
this.input = List…MODULE . a p p l y ( P r e d e f . . M O D U L E .apply(Predef..MODULE .wrapIntArray(new int[] { 1, 2, 3, 4, 5 }));
“xs” <error(s)_during_the_evaluation>
?id=5b53bf1a0d57ac706389c4004f7f5d4c&type=note
假設目標字串 s,長度i,詞典為 dict,f(i) 表示子串 [0,i) 是否可以被“break”,那麼,對於所有的以 dict 中的詞語 s[k,i) 結尾的 s,只要其中一條的 f(k) 為true,f(i) 就為true:
f(i) = (s[k,i) ∈ dict) && f(k)

2O16-01-06

  1. ZCRM_TASK_0001
    2016-01-07
  2. key a: FA163EE56C3A1EE5AD89008F1DBB0B45
  3. key b: FA163EE56C3A1EE5AD8901590BA7CB46
    input guid: FA163EE56C3A1EE5AD89008F1DBB0B45
    CL_CRM_TASK_RT~GET_DOCUMENT_HISTORY
    =CORREL(A1:A8,B1:B8)
    =CORREL(A1:A8,B1:B8)
    opp id: 2319 085859 TARGET OPP ID: 2763
    LOOP AT lt_orderadm_i_wrk ASSIGNING <ls_orderadm_i_wrk>.
          lv_objkey = <ls_orderadm_i_wrk>-guid.


          INSERT lv_objkey INTO TABLE lt_objkey.
        ENDLOOP.
*       header item relations -> first access SRELROLES directly to check whether there are relations for Sales Order items
        SELECT objkey objtype logsys
          FROM srrelroles
          INTO TABLE lt_bor_object
          FOR ALL ENTRIES IN lt_objkey
          WHERE objkey = lt_objkey-table_line.

re/?id=9d45783d487f9949595a681cfa623c5a&type=note

張傑的部落格: http://www.perfect-is-shit.com/

Standardized Technical Architecture Modeling TAM

2016-01-09

.catListTag ul li:hover {
    background: #ff5e52;
    cursor: pointer;
    color: #fff;
}

cd tmp/a/b/c && pwd
import scala.{specialized => sp}
trait S1[@sp A, @sp B, @sp C, @sp D] { def f(p1:A): Unit }

2016-01-11

  1. account 4105192

[email protected]
FA163E8EAB031EE5AE860E0E5FDF22C9
?id=ded64d1a54f7cc3420b8687bb7792067&type=note
輸入文字,用box-shadow生成文字

2016-01-12

  1. task id: 31454
    campaign: C-00000031
def testFunctionArgument2(code :() => Unit){
     println("start")
     code() // 必須寫成code(), 顯式呼叫傳入的函式
     println("end")
}
testFunctionArgument2{
  println("when evaluated")
  println("bb")India: 000 8001007702
India, Bangalore: +91 80 6127 5055
}

task function0有campaign
CRMT_ODATA_TASK_DOC_HISTORY
CRMT_ODATA_DOC_HISTORY
CRMT_ODATA_TASK_DOC_HIST_INCL
CRMT_ODATA_DOC_HIST_INCL
IT_KEY_TAB /IWBEP/T_MGW_NAME_VALUE_PAIR
CT_ENTITYSET ANY TABLE
DocumentHistory

TYPE CL_CRM_TASK_MPC=>TT_DOCUMENTHISTORY
CRMT_ODATA_DOC_HISTORY_T

2016-01-13

  1. task 31362 has two histories
    31363 has 3 histories
    /IWFND/GW_CLIENT Millisecond
    interface note: 382817
    content note: 493852
    /IWFND/TRACES
    Measure the performance of your OData service: http://scn.sap.com/community/gateway/blog/2016/01/13/measure-the-performance-of-your-odata-service
    e/?id=db2780fb6ada3889e1a9b9f6317ab806&type=note
    object Color extends Enumeration {
    val Red, Yellow, Green = Value
    }
    def f(x:Int) = if ( x > 2 ) Some(x) else None
    val l = List(1,2,3,4,5)
    /sap/opu/odata/sap/CRM_ODATA/TaskCollection?KaTeX parse error: Expected 'EOF', got '&' at position 24: …sMyTask eq true&̲expand=DocumentHistories
    40F2E963AFAA1ED49B802B5CA914031E
    opp 2035 has one product, guid: FA163EE56C3A1EE5A6C8C7002E57FF2C

2016-01-14

  1. re/?id=27e4548f5f6ba026ea63b1317958e1f1&type=note
    Implicit parameter pass in Scala : http://scn.sap.com/blogs/i042416/2016/01/14/implicit-parameter-pass-in-scala
    e.youdao.com/share/?id=5b12b41eef055e2297c629001cabf575&type=note
    BUS2000125:task
    task guid: FA163EE56C3A1ED5AE9AE011B059611E
    AG3/815 TR: AG3K156203<