標籤

4GL (1) 人才發展 (10) 人物 (3) 太陽能 (4) 心理 (3) 心靈 (10) 文學 (31) 生活常識 (14) 光學 (1) 名句 (10) 即時通訊軟體 (2) 奇狐 (2) 音樂 (2) 產業 (5) 郭語錄 (3) 無聊 (3) 統計 (4) 新聞 (1) 經濟學 (1) 經營管理 (42) 解析度 (1) 遊戲 (5) 電學 (1) 網管 (10) 廣告 (1) 數學 (1) 機率 (1) 雜趣 (1) 證券 (4) 證券期貨 (1) ABAP (15) AD (1) agentflow (4) AJAX (1) Android (1) AnyChart (1) Apache (14) BASIS (4) BDL (1) C# (1) Church (1) CIE (1) CO (38) Converter (1) cron (1) CSS (23) DMS (1) DVD (1) Eclipse (1) English (1) excel (5) Exchange (4) Failover (1) FI (57) File Transfer (1) Firefox (2) FM (2) fourjs (1) gladiatus (1) google (1) Google Maps API (2) grep (1) Grub (1) HR (2) html (23) HTS (8) IE (1) IE 8 (1) IIS (1) IMAP (3) Internet Explorer (1) java (3) JavaScript (22) jQuery (6) JSON (1) K3b (1) LED (3) Linux (112) Linux Mint (4) Load Balance (1) Microsoft (2) MIS (2) MM (51) MSSQL (1) MySQL (27) Network (1) NFS (1) Office (1) Oracle (125) Outlook (3) PDF (6) Perl (59) PHP (33) PL/SQL (1) PL/SQL Developer (1) PM (3) Postfix (2) postfwd (1) PostgreSQL (1) PP (50) python (1) QM (1) Red Hat (4) Reporting Service (28) ruby (11) SAP (234) scp (1) SD (16) sed (1) Selenium-WebDriver (5) shell (5) SQL (4) SQL server (8) SQuirreL SQL Client (1) SSH (2) SWOT (3) Symantec (2) T-SQL (7) Tera Term (2) tip (1) tiptop (22) Tomcat (6) Trouble Shooting (1) Tuning (5) Ubuntu (33) ufw (1) utf-8 (1) VIM (11) Virtual Machine (2) vnc (3) Web Service (2) wget (1) Windows (19) Windows (1) WM (6) youtube (1) yum (2)

2013年10月30日 星期三

JavaScript : 讀取CSV


 最下面有例子
 
    // This will parse a delimited string into an array of
    // arrays. The default delimiter is the comma, but this
    // can be overriden in the second argument.
    function CSVToArray( strData, strDelimiter ){
        // Check to see if the delimiter is defined. If not,
        // then default to comma.
        strDelimiter = (strDelimiter || ",");

        // Create a regular expression to parse the CSV values.
        var objPattern = new RegExp(
            (
                // Delimiters.
                "(\\" + strDelimiter + "|\\r?\\n|\\r|^)" +

                // Quoted fields.
                "(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|" +

                // Standard fields.
                "([^\"\\" + strDelimiter + "\\r\\n]*))"
            ),
            "gi"
            );


        // Create an array to hold our data. Give the array
        // a default empty first row.
        var arrData = ;

        // Create an array to hold our individual pattern
        // matching groups.
        var arrMatches = null;


        // Keep looping over the regular expression matches
        // until we can no longer find a match.
        while (arrMatches = objPattern.exec( strData )){

            // Get the delimiter that was found.
            var strMatchedDelimiter = arrMatches[ 1 ];

            // Check to see if the given delimiter has a length
            // (is not the start of string) and if it matches
            // field delimiter. If id does not, then we know
            // that this delimiter is a row delimiter.
            if (
                strMatchedDelimiter.length &&
                (strMatchedDelimiter != strDelimiter)
                ){

                // Since we have reached a new row of data,
                // add an empty row to our data array.
                arrData.push( [] );

            }


            // Now that we have our delimiter out of the way,
            // let's check to see which kind of value we
            // captured (quoted or unquoted).
            if (arrMatches[ 2 ]){

                // We found a quoted value. When we capture
                // this value, unescape any double quotes.
                var strMatchedValue = arrMatches[ 2 ].replace(
                    new RegExp( "\"\"", "g" ),
                    "\""
                    );

            } else {

                // We found a non-quoted value.
                var strMatchedValue = arrMatches[ 3 ];

            }


            // Now that we have our value string, let's add
            // it to the data array.
            arrData[ arrData.length - 1 ].push( strMatchedValue );
        }

        // Return the parsed data.
        return( arrData );
    }

var aaa = "aaa,\"2,400\",ccc";
var ary = CSVToArray(aaa,",");
Form.showMessageDialog(ary[0][2]); //會回傳2,400

replace regular expression


replaceAll 不是JavaScript function,要用replace

var ary = CSVToArray(line,",");
var txt1  = ary[0][0];  //項目
var spec  = ary[0][1];  //規格
var preis = ary[0][2];  //單價
var qty   = ary[0][3];  //數量
var amt   = ary[0][4];  //價格
var txt2  = ary[0][5];  //備註
var cat   = ary[0][6];  //類型
var trsf  = ary[0][7];  //是否轉檔
var matnr = ary[0][8];  //料號
var bsart = ary[0][9];  //PR Order Type ; PR類別
var ekgrp = ary[0][10]; //採購代號
var matkl = ary[0][11]; //material group

if (preis.indexOf(",") >= 0) {
  preis = preis.replace(/,/g,"");
}
if (qty.indexOf(",") >= 0) {
  qty = qty.replace(/,/g,"");
}
if (amt.indexOf(",") >= 0) {
  amt = amt.replace(/,/g,"");
}
preis = parseFloat(preis);
qty = parseFloat(qty);
amt = parseFloat(amt);

ABAP : 前面 + 0

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT = LT_BANFN
      IMPORTING
        OUTPUT = LT_BANFN.

JavaScript : lpad

function lpad(n, width, z) {
  z = z || '0';
  n = n + '';
  return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
}

Form.showMessageDialog(lpad("123",10,"0"));

JavaScript Date Format

http://blog.stevenlevithan.com/archives/date-time-format

JavaScript Date Format

Update: The documentation below has been updated for the new Date Format 1.2. Get it now!
Although JavaScript provides a bunch of methods for getting and setting parts of a date object, it lacks a simple way to format dates and times according to a user-specified mask. There are a few scripts out there which provide this functionality, but I've never seen one that worked well for me… Most are needlessly bulky or slow, tie in unrelated functionality, use complicated mask syntaxes that more or less require you to read the documentation every time you want to use them, or don't account for special cases like escaping mask characters within the generated string.
When choosing which special mask characters to use for my JavaScript date formatter, I looked at PHP's date function and ColdFusion's discrete dateFormat and timeFormat functions. PHP uses a crazy mix of letters (to me at least, since I'm not a PHP programmer) to represent various date entities, and while I'll probably never memorize the full list, it does offer the advantages that you can apply both date and time formatting with one function, and that none of the special characters overlap (unlike ColdFusion where m and mm mean different things depending on whether you're dealing with dates or times). On the other hand, ColdFusion uses very easy to remember special characters for masks.
With my date formatter, I've tried to take the best features from both, and add some sugar of my own. It did end up a lot like the ColdFusion implementation though, since I've primarily used CF's mask syntax.
Before getting into further details, here are some examples of how this script can be used:
var now = new Date();

now.format("m/dd/yy");
// Returns, e.g., 6/09/07

// Can also be used as a standalone function
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");
// Saturday, June 9th, 2007, 5:46:21 PM

// You can use one of several named masks
now.format("isoDateTime");
// 2007-06-09T17:46:21

// ...Or add your own
dateFormat.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
now.format("hammerTime");
// 17:46! Can't touch this!

// When using the standalone dateFormat function,
// you can also provide the date as a string
dateFormat("Jun 9 2007", "fullDate");
// Saturday, June 9, 2007

// Note that if you don't include the mask argument,
// dateFormat.masks.default is used
now.format();
// Sat Jun 09 2007 17:46:21

// And if you don't include the date argument,
// the current date and time is used
dateFormat();
// Sat Jun 09 2007 17:46:22

// You can also skip the date argument (as long as your mask doesn't
// contain any numbers), in which case the current date/time is used
dateFormat("longTime");
// 5:46:22 PM EST

// And finally, you can convert local time to UTC time. Either pass in
// true as an additional argument (no argument skipping allowed in this case):
dateFormat(now, "longTime", true);
now.format("longTime", true);
// Both lines return, e.g., 10:46:21 PM UTC

// ...Or add the prefix "UTC:" to your mask.
now.format("UTC:h:MM:ss TT Z");
// 10:46:21 PM UTC
Following are the special characters supported. Any differences in meaning from ColdFusion's dateFormat and timeFormat functions are noted.
Mask Description
d Day of the month as digits; no leading zero for single-digit days.
dd Day of the month as digits; leading zero for single-digit days.
ddd Day of the week as a three-letter abbreviation.
dddd Day of the week as its full name.
m Month as digits; no leading zero for single-digit months.
mm Month as digits; leading zero for single-digit months.
mmm Month as a three-letter abbreviation.
mmmm Month as its full name.
yy Year as last two digits; leading zero for years less than 10.
yyyy Year represented by four digits.
h Hours; no leading zero for single-digit hours (12-hour clock).
hh Hours; leading zero for single-digit hours (12-hour clock).
H Hours; no leading zero for single-digit hours (24-hour clock).
HH Hours; leading zero for single-digit hours (24-hour clock).
M Minutes; no leading zero for single-digit minutes.
Uppercase M unlike CF timeFormat's m to avoid conflict with months.
MM Minutes; leading zero for single-digit minutes.
Uppercase MM unlike CF timeFormat's mm to avoid conflict with months.
s Seconds; no leading zero for single-digit seconds.
ss Seconds; leading zero for single-digit seconds.
l or L Milliseconds. l gives 3 digits. L gives 2 digits.
t Lowercase, single-character time marker string: a or p.
No equivalent in CF.
tt Lowercase, two-character time marker string: am or pm.
No equivalent in CF.
T Uppercase, single-character time marker string: A or P.
Uppercase T unlike CF's t to allow for user-specified casing.
TT Uppercase, two-character time marker string: AM or PM.
Uppercase TT unlike CF's tt to allow for user-specified casing.
Z US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the Opera browser, the GMT/UTC offset is returned, e.g. GMT-0500
No equivalent in CF.
o GMT/UTC timezone offset, e.g. -0500 or +0230.
No equivalent in CF.
S The date's ordinal suffix (st, nd, rd, or th). Works well with d.
No equivalent in CF.
'…' or "…" Literal character sequence. Surrounding quotes are removed.
No equivalent in CF.
UTC: Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The "UTC:" prefix is removed.
No equivalent in CF.
And here are the named masks provided by default (you can easily change these or add your own):
Name Mask Example
default ddd mmm dd yyyy HH:MM:ss Sat Jun 09 2007 17:46:21
shortDate m/d/yy 6/9/07
mediumDate mmm d, yyyy Jun 9, 2007
longDate mmmm d, yyyy June 9, 2007
fullDate dddd, mmmm d, yyyy Saturday, June 9, 2007
shortTime h:MM TT 5:46 PM
mediumTime h:MM:ss TT 5:46:21 PM
longTime h:MM:ss TT Z 5:46:21 PM EST
isoDate yyyy-mm-dd 2007-06-09
isoTime HH:MM:ss 17:46:21
isoDateTime yyyy-mm-dd'T'HH:MM:ss 2007-06-09T17:46:21
isoUtcDateTime UTC:yyyy-mm-dd'T'HH:MM:ss'Z' 2007-06-09T22:46:21Z
A couple issues:
  • In the unlikely event that there is ambiguity in the meaning of your mask (e.g., m followed by mm, with no separating characters), put a pair of empty quotes between your metasequences. The quotes will be removed automatically.
  • If you need to include literal quotes in your mask, the following rules apply:
    • Unpaired quotes do not need special handling.
    • To include literal quotes inside masks which contain any other quote marks of the same type, you need to enclose them with the alternative quote type (i.e., double quotes for single quotes, and vice versa). E.g., date.format('h "o\'clock, y\'all!"') returns "6 o'clock, y'all". This can get a little hairy, perhaps, but I doubt people will really run into it that often. The previous example can also be written as date.format("h") + "o'clock, y'all!".
Here's the code:
/*
 * Date Format 1.2.3
 * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
 * MIT license
 *
 * Includes enhancements by Scott Trenda <scott.trenda.net>
 * and Kris Kowal <cixar.com/~kris.kowal/>
 *
 * Accepts a date, a mask, or a date and a mask.
 * Returns a formatted version of the given date.
 * The date defaults to the current date/time.
 * The mask defaults to dateFormat.masks.default.
 */

var dateFormat = function () {
 var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
  timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
  timezoneClip = /[^-+\dA-Z]/g,
  pad = function (val, len) {
   val = String(val);
   len = len || 2;
   while (val.length < len) val = "0" + val;
   return val;
  };

 // Regexes and supporting functions are cached through closure
 return function (date, mask, utc) {
  var dF = dateFormat;

  // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
  if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
   mask = date;
   date = undefined;
  }

  // Passing date through Date applies Date.parse, if necessary
  date = date ? new Date(date) : new Date;
  if (isNaN(date)) throw SyntaxError("invalid date");

  mask = String(dF.masks[mask] || mask || dF.masks["default"]);

  // Allow setting the utc argument via the mask
  if (mask.slice(0, 4) == "UTC:") {
   mask = mask.slice(4);
   utc = true;
  }

  var _ = utc ? "getUTC" : "get",
   d = date[_ + "Date"](),
   D = date[_ + "Day"](),
   m = date[_ + "Month"](),
   y = date[_ + "FullYear"](),
   H = date[_ + "Hours"](),
   M = date[_ + "Minutes"](),
   s = date[_ + "Seconds"](),
   L = date[_ + "Milliseconds"](),
   o = utc ? 0 : date.getTimezoneOffset(),
   flags = {
    d:    d,
    dd:   pad(d),
    ddd:  dF.i18n.dayNames[D],
    dddd: dF.i18n.dayNames[D + 7],
    m:    m + 1,
    mm:   pad(m + 1),
    mmm:  dF.i18n.monthNames[m],
    mmmm: dF.i18n.monthNames[m + 12],
    yy:   String(y).slice(2),
    yyyy: y,
    h:    H % 12 || 12,
    hh:   pad(H % 12 || 12),
    H:    H,
    HH:   pad(H),
    M:    M,
    MM:   pad(M),
    s:    s,
    ss:   pad(s),
    l:    pad(L, 3),
    L:    pad(L > 99 ? Math.round(L / 10) : L),
    t:    H < 12 ? "a"  : "p",
    tt:   H < 12 ? "am" : "pm",
    T:    H < 12 ? "A"  : "P",
    TT:   H < 12 ? "AM" : "PM",
    Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
    o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
    S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
   };

  return mask.replace(token, function ($0) {
   return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
  });
 };
}();

// Some common format strings
dateFormat.masks = {
 "default":      "ddd mmm dd yyyy HH:MM:ss",
 shortDate:      "m/d/yy",
 mediumDate:     "mmm d, yyyy",
 longDate:       "mmmm d, yyyy",
 fullDate:       "dddd, mmmm d, yyyy",
 shortTime:      "h:MM TT",
 mediumTime:     "h:MM:ss TT",
 longTime:       "h:MM:ss TT Z",
 isoDate:        "yyyy-mm-dd",
 isoTime:        "HH:MM:ss",
 isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
 isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};

// Internationalization strings
dateFormat.i18n = {
 dayNames: [
  "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
  "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
 ],
 monthNames: [
  "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
  "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
 ]
};

// For convenience...
Date.prototype.format = function (mask, utc) {
 return dateFormat(this, mask, utc);
};
Download it here (1.2 KB when minified and gzipped).
Note that the day and month names can be changed (for internationalization or other purposes) by updating the dateFormat.i18n object.
If you have any suggestions or find any issues, lemme know.

New library: Are you a JavaScript regex master, or want to be? Then you need my fancy XRegExp library. It adds new regex syntax (including named capture and Unicode properties); s, x, and n flags; powerful regex utils; and it fixes pesky browser inconsistencies. Check it out!

Audit of SAP multiple logons

http://life124.pixnet.net/blog/post/7302526-audit-of-sap-multiple-logons
Audit of SAP multiple logons
SAP 允許重複登入(multiple logon);當使用者要重複登入時,SAP 會跳出三個選項,當中有一個訊息是這樣寫的:
If you continue with this logon without ending any existing logons to system, this will be logged in the system. SAP reserves the right to view this information.
上面說,SAP 會將重複登入的資訊記錄起來。那紀錄在哪裡呢?要怎樣看?
T-code: SE16 Table: USR41_MLD'Counter' 這個欄位就是告訴你,使用者繼續重複登入的次數(how many times the user have done a multiple logon)
不過,看這個有什麼用?對 FS 應該沒有什麼影響吧....
Disable SAP USERS to logon multiple times
如果要停用重複登入,要怎麼設定呢?
T-code: RZ10 設定參數 login/disable_multi_gui_login:
  • ·                         0 => 不啟用,允許重複登入
  • ·                         1 => 啟用,不允許重複登入
那如果只要對少數人開放,其他人都不允許重複登入,又該如何設定?
除了上述的參數 login/disable_multi_gui_login = 1 之外,另外設定參數 login/multi_login_users,將欲開放重複登入的使用者帳號輸入於此,每個使用者帳號之間用逗號 “,” 分隔,並且不要留空白,重開 R/3 即可。
Maximum No. of SAP Session Per User

SAP 4.6x
預設允許每個使用者開啟 6 session 連線,如果要修改,用 T-code: RZ10 修改參數 rdisp/max_alt_modes 即可。要生效當然要重開 R/3

2013年10月26日 星期六

SAP : submit program (Calling Executable Programs example)


submit ZRCO007 and return
  VIA SELECTION-SCREEN       "此行會讓user要手動run外部程式(手動按F8)
  EXPORTING LIST TO MEMORY      "此行會使WRITE LIST不會顯示在螢幕上,而是放到memory
  with selection-table seltab. "將所有selection screen的參數全部經由seltab參數傳給程式執行

example:

*&---------------------------------------------------------------------*
*& Report  YTEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  YTEST.

  data: seltab type table of rsparams,
        seltab_wa like line of seltab.

  seltab_wa-selname = 'P_KOKRS'.
  seltab_wa-kind = 'P'.
  seltab_wa-low = 'BS00'.
  append seltab_wa to seltab.

  seltab_wa-selname = 'P_BUKRS'.
  seltab_wa-kind = 'P'.
  seltab_wa-low = '1000'.
  append seltab_wa to seltab.

  seltab_wa-selname = 'P_WERKS'.
  seltab_wa-kind = 'P'.
  seltab_wa-low = '1000'.
  append seltab_wa to seltab.

  seltab_wa-selname = 'P_YM'.
  seltab_wa-kind = 'P'.
*  seltab_wa-low = sy-datum+0(6).
  seltab_wa-low = '201003'.
  append seltab_wa to seltab.

  seltab_wa-selname = 'P_ACTPR'.
  seltab_wa-kind = 'P'.
  seltab_wa-low = 'X'.
  append seltab_wa to seltab.

  seltab_wa-selname = 'AUFNR'.
  seltab_wa-kind = 'S'.
  seltab_wa-sign    = 'I'.
  seltab_wa-option  = 'EQ'.
*  seltab_wa-low = 'B6MSD8-13068'.
  seltab_wa-low = '1000056'.
  append seltab_wa to seltab.

  seltab_wa-selname = 'R_BUDAT'.
  seltab_wa-kind = 'S'.
  seltab_wa-sign    = 'I'.
  seltab_wa-option  = 'BT'.
  seltab_wa-low = '20130301'.
  seltab_wa-high = '20130331'.
*  seltab_wa-low = '20130901'.
*  seltab_wa-high = '20130930'.
  append seltab_wa to seltab.

  submit ZRCO007 and return
*    VIA SELECTION-SCREEN
    with selection-table seltab.

2013年10月21日 星期一

Activate &SAP_EDIT in SE16N (SAP ECC 6.0 EHP6)

http://tsapanoglou.wordpress.com/2012/10/10/activate-sap_edit-in-se16n-sap-ecc-6-0-ehp6/

Activate &SAP_EDIT in SE16N (SAP ECC 6.0 EHP6)

In SAP ECC 6.0 EHP6, the function code &SAP_EDIT, which enables the change mode of transaction SE16N, is deactivated (SAP Note 1420281) due to security breaches that were detected. In order to activate it (temporarily), follow the steps below:
  1. Go to SE16N, as usual, and type the table for which you want to make modifications.
  2. Instead of typing &SAP_EDIT in the command field, type /H and press “Enter” key to activate debugging.
  3. Press F8 key to enter the data browser for the above table.
  4. While in debugging mode, enter the two variables GD-EDIT and GD-SAPEDIT and press “Enter” key.
  5. For each variable, click on the change button, change the value to an uppercase “X” and press “Enter” key.
  6. Press F8 key to exit debugging and enter the table in change mode.
  7.  

2013年10月19日 星期六

Tomcat的JVM設置和連接數設置

http://fecbob.pixnet.net/blog/post/38257503

一、Tomcat的JVM提示記憶體溢出

查看%TOMCAT_HOME%\logs資料夾下,日誌檔是否有記憶體溢出錯誤

二、修改Tomcat的JVM

1、錯誤提示:java.lang.OutOfMemoryError: JAVA heap space

Tomcat預設可以使用的記憶體為128MB,在較大型的應用專案中,這點記憶體是不夠的,有可能導致系統無法運行。常見的問題是報Tomcat記憶體溢出錯誤,Out of Memory(系統記憶體不足)的異常,從而導致用戶端顯示500錯誤,一般調整Tomcat的使用記憶體即可解決此問題。

Windows環境下修改「%TOMCAT_HOME%\bin\catalina.bat」檔,在檔開頭增加如下設置:set JAVA_OPTS=-Xms256m -Xmx512m

Linux環境下修改「%TOMCAT_HOME%\bin\catalina.sh」檔,在檔開頭增加如下設置:JAVA_OPTS=’-Xms256m -Xmx512m’

其中,-Xms設置初始化記憶體大小,-Xmx設置可以使用的最大記憶體。

2、錯誤提示:java.lang.OutOfMemoryError: PermGen space

原因:
PermGen space的全稱是Permanent Generation space,是指記憶體的永久保存區域,這塊記憶體主要是被JVM存
放Class和Meta資訊的,Class在被Loader時就會被放到PermGen space中,它和存放類實例(Instance)的
Heap區域不同,GC(Garbage Collection)不會在主程式運行期對PermGen space進行清理,所以如果你的應用
中有很CLASS的話,就很可能出現PermGen space錯誤,這種錯誤常見在web伺服器對JSP進行pre compile的
時候。如果你的WEB APP下都用了大量的協力廠商jar, 其大小超過了jvm預設的大小(4M)那麼就會產生此錯誤信
息了。
解決方法:

在catalina.bat的第一行增加:
set JAVA_OPTS=-Xms64m -Xmx256m -XX:PermSize=128M -XX:MaxNewSize=256m -
XX:MaxPermSize=256m
在catalina.sh的第一行增加:
JAVA_OPTS=-Xms64m -Xmx256m -XX:PermSize=128M -XX:MaxNewSize=256m -
XX:MaxPermSize=256m

3、JVM設置

堆的尺寸
-Xmssize in bytes
設定JAVA堆的初始尺寸,缺省尺寸是2097152 (2MB)。這個值必須是1024個位元組(1KB)的倍數,且比它大。(-server選項把缺省尺寸增加到32M。
-Xmnsize in bytes
為Eden物件設定初始JAVA堆的大小,缺省值為640K。(-server選項把缺省尺寸增加到2M。)
-Xmxsize in bytes
設定JAVA堆的最大尺寸,缺省值為64M,(-server選項把缺省尺寸增加到128M。) 最大的堆尺寸達到將近2GB(2048MB)。

請注意:很多垃圾收集器的選項依賴于堆大小的設定。請在微調垃圾收集器使用記憶體空間的方式之前,確認是否已經正確設定了堆的尺寸。

垃圾收集:記憶體的使用
-XX:MinHeapFreeRatio=percentage as a whole number
修改垃圾回收之後堆中可用記憶體的最小百分比,缺省值是40。如果垃圾回收後至少還有40%的堆記憶體沒有被釋放,則系統將增加堆的尺寸。
-XX:MaxHeapFreeRatio=percentage as a whole number
改變垃圾回收之後和堆記憶體縮小之前可用堆記憶體的最大百分比,缺省值為70。這意味著如果在垃圾回收之後還有大於70%的堆記憶體,則系統就會減少堆的尺寸。
-XX:NewSize=size in bytes
為已分配記憶體的物件中的Eden代設置缺省的記憶體尺寸。它的缺省值是640K。(-server選項把缺省尺寸增加到2M。
-XX:MaxNewSize=size in bytes
允許您改變初期物件空間的上限,新建物件所需的記憶體就是從這個空間中分配來的,這個選項的缺省值是640K。(-server選項把缺省尺寸增加到2M。
-XX:NewRatio=value
改變新舊空間的尺寸比例,這個比例的缺省值是8,意思是新空間的尺寸是舊空間的1/8。
-XX:SurvivorRatio=number
改變Eden物件空間和殘存空間的尺寸比例,這個比例的缺省值是10,意思是Eden物件空間的尺寸比殘存空間大survivorRatio+2倍。
-XX:TargetSurvivorRatio=percentage
設定您所期望的空間提取後被使用的殘存空間的百分比,缺省值是50。
-XX:MaxPermSize=size in MB
長久代(permanent generation)的尺寸,缺省值為32(32MB)。

三、查看Tomcat的JVM記憶體

1. Tomcat6中沒有設置任何預設使用者,因而需要手動往Tomcat6的conf資料夾下的tomcat-users.xml檔中添加使用者。


如:<role rolename="manager"/>
<user username="tomcat" password="tomcat" roles="manager"/>

注:添加完需要重啟Tomcat6。


2. 訪問HTTP://localhost:8080/manager/status,輸入上面添加的使用者名和密碼。


3. 然後在如下面的JVM下可以看到記憶體的使用方式。

JVM
Free memory: 2.50 MB Total memory: 15.53 MB Max memory: 63.56 MB

四、Tomcat連接數設置

在tomcat設定檔server.xml中的<Connector ... />配置中,和連接數相關的參數有:
minProcessors:最小空閒連接線程數,用於提高系統處理性能,預設值為10
maxProcessors:最大連接線程數,即:併發處理的最大請求數,預設值為75
acceptCount:允許的最大連接數,應大於等於maxProcessors,預設值為100
enableLookups:是否反查功能變數名稱,取值為:true或false。為了提高處理能力,應設置為false
connectionTimeout:網路連接超時,單位:毫秒。設置為0表示永不超時,這樣設置有隱患的。通常可設置為30000毫秒。

其中和最大連接數相關的參數為maxProcessors和acceptCount。如果要加大併發連接數,應同時加大這兩個參數。


web server允許的最大連接數還受制于作業系統的內核參數設置,通常Windows是2000個左右,Linux是1000個左右。Unix中如何設置這些參數,請參閱Unix常用監控和管理命令

如何在 Tomcat 中設定JVM系統變數

http://icercat.pixnet.net/blog/post/25101002-%E5%A6%82%E4%BD%95%E5%9C%A8-tomcat-%E4%B8%AD%E8%A8%AD%E5%AE%9Ajvm%E7%B3%BB%E7%B5%B1%E8%AE%8A%E6%95%B8

這篇要教如何設定 JVM 系統變數(system property)
Tomcat 有兩種啟動程式,Windows Service 或是 bat 啟動
兩種設定法不同

1. Windows Service 法啟動
以 Tomcat 6 為例
執行 %CATALINA_HOME%/bin/tomcat6w.exe
切換到 Java 頁籤, Java Options 的欄位就是 JVM 的系統變數了

2. bat/exe 啟動
使用文字編輯器開啟 %CATALINA_HOME%/bin/catalina.bat
找到下面這段

%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%


接著在 java.io.tmpdir 變數之後加入你想加入的環境變數
格式為 -D=""
例如我想加入 WF_HOME,值為 "D:\Workflow"
寫法為
-DWF_HOME="D:\Workflow"
ps. 請記得雙引號

加完的結果如下
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" -DWF_HOME="D:\Workflow" -DWF_CONFIG_HOME="D:\Workflow\config" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%


2013年10月16日 星期三

SAP FI Validation : OB28 menu path

http://ierp.us/sap-spro/sap_configuration_spro_img.php?id=4594

01. SAP Customizing Implementation Guide
02.-- Financial Accounting

03.---- Financial Accounting Global Settings
04.------ Document
05.-------- Document Header
06.---------- Validation in Accounting Documents - S_ALR_87003696  


2013年10月12日 星期六

rip off

當你聽到有人花了大筆錢卻物不超所值、甚至被敲竹槓時,便可以說:That’s a rip-off!rip-off是名詞,意為「剝削;冒牌貨」)。

另一個說法則是:You got ripped-off.(你被敲竹槓了)。

當然,如果哪天輪到你被敲竹槓,這時就可以說:I got stiffed.

travesty

travesty: [ 'trævisti ] 

n. 滑稽化的作品,漫画
v. 使...滑稽化


例句与用法:
1.The trial was a travesty of justice. 

这次审判嘲弄了法律的公正性.

2.His trial was a travesty of justice. 

对他进行审判是对正义的歪曲。

2013年10月10日 星期四

BAPI_ACC_DOCUMENT_POST enhancement

緣起:
由於一般費用請款需要上傳tax,而user又要求tax要註明憑證資訊;偏偏 BAPI_ACC_DOCUMENT_POST根本就沒有tax 的item text欄位可以填...不得以之下,只好動用BAPI_ACC_DOCUMENT_POST的EXTENSION1這個table來輔助上傳tax item_text。

步驟:
1. 首先客製Z_ACC_DOCUMENT_POST,呼叫 BAPI_ACC_DOCUMENT_POST
FUNCTION Z_ACC_DOCUMENT_POST.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_DOCUMENTHEADER) TYPE  BAPIACHE09
*"     VALUE(I_CUSTOMERCPD) TYPE  BAPIACPA09 OPTIONAL
*"     VALUE(I_CONTRACTHEADER) TYPE  BAPIACCAHD OPTIONAL
*"  EXPORTING
*"     VALUE(E_OBJ_TYPE) TYPE  BAPIACHE09-OBJ_TYPE
*"     VALUE(E_OBJ_KEY) TYPE  BAPIACHE09-OBJ_KEY
*"     VALUE(E_OBJ_SYS) TYPE  BAPIACHE09-OBJ_SYS
*"  TABLES
*"      T_ACCOUNTGL STRUCTURE  BAPIACGL09 OPTIONAL
*"      T_ACCOUNTRECEIVABLE STRUCTURE  BAPIACAR09 OPTIONAL
*"      T_ACCOUNTPAYABLE STRUCTURE  BAPIACAP09 OPTIONAL
*"      T_ACCOUNTTAX STRUCTURE  BAPIACTX09 OPTIONAL
*"      T_CURRENCYAMOUNT STRUCTURE  BAPIACCR09
*"      T_CRITERIA STRUCTURE  BAPIACKEC9 OPTIONAL
*"      T_VALUEFIELD STRUCTURE  BAPIACKEV9 OPTIONAL
*"      T_EXTENSION1 STRUCTURE  BAPIACEXTC OPTIONAL
*"      T_RETURN STRUCTURE  BAPIRET2
*"      T_PAYMENTCARD STRUCTURE  BAPIACPC09 OPTIONAL
*"      T_CONTRACTITEM STRUCTURE  BAPIACCAIT OPTIONAL
*"      T_EXTENSION2 STRUCTURE  BAPIPAREX OPTIONAL
*"      T_REALESTATE STRUCTURE  BAPIACRE09 OPTIONAL
*"      T_ACCOUNTWT STRUCTURE  BAPIACWT09 OPTIONAL
*"----------------------------------------------------------------------
  data l_ok type char0001.

  call function 'BAPI_ACC_DOCUMENT_POST'
    exporting
      DOCUMENTHEADER    = I_DOCUMENTHEADER
      CUSTOMERCPD       = I_CUSTOMERCPD
      CONTRACTHEADER    = I_CONTRACTHEADER
    importing
      OBJ_TYPE          = E_OBJ_TYPE
      OBJ_KEY           = E_OBJ_KEY
      OBJ_SYS           = E_OBJ_SYS
    tables
      ACCOUNTGL         = T_ACCOUNTGL
      ACCOUNTRECEIVABLE = T_ACCOUNTRECEIVABLE
      ACCOUNTPAYABLE    = T_ACCOUNTPAYABLE
      ACCOUNTTAX        = T_ACCOUNTTAX
      CURRENCYAMOUNT    = T_CURRENCYAMOUNT
      CRITERIA          = T_CRITERIA
      VALUEFIELD        = T_VALUEFIELD
      EXTENSION1        = T_EXTENSION1
      RETURN            = T_RETURN
      PAYMENTCARD       = T_PAYMENTCARD
      CONTRACTITEM      = T_CONTRACTITEM
      EXTENSION2        = T_EXTENSION2
      REALESTATE        = T_REALESTATE
      ACCOUNTWT         = T_ACCOUNTWT.

  l_ok = '1'.

  loop at t_return.
    if t_return-type = 'E'.
      l_ok = '0'.
    endif.
  endloop.

  if l_ok = '1'.
    call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait = 'X'.
  endif.
ENDFUNCTION.
 
 

2.上傳example
T_ACCOUNTGL
ITEMNO_ACC                     0000000010
GL_ACCOUNT                     67390010
ITEM_TEXT                      TEST -消耗品
DOC_TYPE                       SA
COMP_CODE                      1000
BUS_AREA                       1000
PSTNG_DATE                     2013/10/09
VALUE_DATE                     2013/10/09


T_ACCOUNTPAYABLE
ITEMNO_ACC                     0000000020
VENDOR_NO                      100696
COMP_CODE                      1000
BUS_AREA                       1000
PMNTTRMS                       M030
BLINE_DATE                     2013/10/09
ITEM_TEXT                      TEST -消耗品


T_ACCOUNTTAX
ITEMNO_ACC                     0000000030
GL_ACCOUNT                     12640010
TAX_CODE                       21
ITEMNO_TAX                     000010

T_CURRENCYAMOUNT
ITEMNO_ACC                     0000000010
CURRENCY_ISO                   TWD
AMT_DOCCUR                                        1,000.0000


ITEMNO_ACC                     0000000020
CURRENCY_ISO                   TWD
AMT_DOCCUR                                        1,050.0000-
DISC_BASE                                           210.0000-


ITEMNO_ACC                     0000000030
CURRENCY_ISO                   TWD
AMT_DOCCUR                                           50.0000
AMT_BASE                                          1,000.0000


T_EXTENSION1
FIELD1                             30
FIELD2                             SGTXT
FIELD3                             ZE10000000 1021001 86378995
FIELD4


3.copy SAMPLE_INTERFACE_RWBAPI01 to ZSAMPLE_INTERFACE_RWBAPI01,並implement code:
  data: wa like IT_ACCIT,
        i type i value 0,
        wa_e like EXTENSION,
        ind type sy-tabix.

  loop at EXTENSION into wa_e.
    read table IT_ACCIT with key POSNR = wa_e-field1 into wa.
    ind = sy-tabix.
    if wa_e-field2 eq 'SGTXT'.
      wa-SGTXT = wa_e-field3.
      modify IT_ACCIT from wa index ind.
      i = i + 1.
    endif.
  endloop.
  


4.客製IMG(在各client都要做,無法transport)





5. 結果







 

如何使用enhancement

1. 先查SMOD,enhancement中有否自己需要的component
2. 到CMOD,看看有否已經存在的project已經將enhancement包含進來

2013年10月9日 星期三

修改greenmall logo 大小

今天遇到沒有source code 的aspx,幸好user只是要修改logo.img 大小。
敘述如下:

1. 先看網頁source code,知道css是哪一個(我一開始沒有這麼做,所以找錯檔案)

2.打開fiefox firebug,用firebug觀察元素,並找出其CSS路徑(移到下方tag那裏點右鍵,就有css路徑選項)

3. css路徑貼上.css 檔案,並加上 {width:450;height:113}。舉例如下
html body table tbody tr td table tbody tr td span#header table tbody tr td table tbody tr td a img {width:450;height:113}

4.但別的元素被影響,也變那麼大,所以底下要將被影響的也加上其自己的css
html body table tbody tr td table tbody tr td span#header table tbody tr td table tbody tr td table tbody tr td a img {width:53;height:50}


2013年10月7日 星期一

XP開機輸入帳號密碼視窗的取消設定

http://billor.chsh.chc.edu.tw/computer/pcSafe/15deLogin.htm

如果電腦設定管理者以外的帳號,那麼電腦開機的時候,會出現輸入帳號、密碼的對話方塊。想要變更「使用者登入或登出的方式」,可依下列步驟操作: 
【方法一】
步驟一:點擊「控制台」→「使用者帳戶」→「變更使用者登入或登出的方式」。
 

步驟二:將『使用歡迎畫面』的項目取消。
 

【方法二】
 步驟一:「開始」→「執行」,輸入:『control userpasswords2』按確定。
 

步驟二:這時會出現「使用者帳戶」的管理畫面,請將「必須輸入使用者名稱和密碼,才能使用這台電腦」的項目取消,然後按「套用」。
 
 
步驟三:此時會出現要求輸入密碼的畫面,請輸入你要自動登入的帳號與密碼,Windows XP就會以該組帳號作為自動登入的帳號。
 

【註】:反之,若想恢復設定,請勾選「必須輸入使用者名稱和密碼,才能使用這台電腦」的項目,然後按「確定」即可。

2013年10月6日 星期日

grisly

嚇人的

albino

白化症

bizarre

奇異的

deja vu

似曾相識

example : It's deja vu. (似曾相識)

計算duedate 的function module


https://scn.sap.com/thread/1155670

Function Module to Calculate Due Date from Payment Terms?
此问题 已被回答。
Gill Ackroyd
I'm writing an aged debtor report as the SAP standard one isn't quite right for our requirements.  Is there a function module that will calculate the payment due date if I give it the payment terms and the base line date?

I did a search in SE37 but couldn't see one which fitted my requirements (I was searching on CALCDUEDATE and variantions of).

Any suggestions welcome, thanks.

Gill
Nitin Karamchandani
正确答案 作者 Nitin Karamchandani  打开 Dec 5, 2008 10:27 AM
Hi Gill,

Use FM DETERMINE_DUE_DATE for the same.

Refer the following link:
FI-ABAP : how to calculate payment date using a module function ?

Hope this will help.
Regards,
Nitin.

前赤壁賦

http://www.epochtimes.com/b5/7/3/13/n1644585.htm


壬戌之秋,七月既望,蘇子與客泛舟遊於赤壁之下。清風徐來,水波不興。舉酒屬(音:主)客,誦明月之詩,歌窈窕之章。少焉,月出於東山之上,徘徊於 斗牛之間。白露橫江,水光接天。縱一葦之所如,凌萬頃之茫然。浩浩乎如馮虛御風,而不知其所止;飄飄乎如遺世獨立,羽化而登仙。 


於是飲酒樂甚,扣舷(音:賢)而歌之。歌曰:「桂棹(音:照)兮蘭槳,擊空明兮泝(音:訴)流光。渺渺兮予懷,望美人兮天一方。」客有吹洞蕭者,倚歌而和之,其聲嗚嗚然:如怨如慕,如泣如訴;餘音嫋嫋,不絕如縷;舞幽壑之潛蛟,泣孤舟之嫠(音:離)婦。
蘇子愀然,正襟危坐,而問客曰:「何為其然也?」 

客 曰:「『月明星稀,烏鵲南飛』,此非曹孟德之詩乎?西望夏口,東望武昌,山川相繆(音:謀),鬱乎蒼蒼;此非孟德之困於周郎者乎?方其破荊州,下江陵,順 流而東也,舳艫(音:軸盧)千里,旌旗蔽空,釃(音:司)酒臨江,橫槊(音:碩) 賦詩;固一世之雄也,而今安在哉?況吾與子漁樵於江渚之上,侶魚蝦而友麋鹿;駕一葉之扁舟,舉匏樽(音:袍尊)以相屬;寄蜉蝣於天地,渺滄海之一粟。哀吾 生之須臾,羨長江之無窮;挾飛仙以遨遊,抱明月而長終;知不可乎驟得,託遺響於悲風。」 

蘇子曰:「客亦知夫水與月乎?逝者如斯,而未嘗往 也;盈虛者如彼,而卒莫消長也。蓋將自其變者而觀之,則天地曾不能以一瞬;自其不變者而觀之,則物與我皆無盡也。而又何羨乎?且夫天地之間,物各有主。苟 非吾之所有,雖一毫而莫取;惟江上之清風,與山間之明月;耳得之而為聲,目遇之而成色。取之無禁,用之不竭。是造物者之無盡藏也,而吾與子之所共適。」 


客喜而笑,洗盞更酌,肴核既盡,杯盤狼藉(音:及)。相與枕藉(音:界)乎舟中,不知東方之既白。

2013年10月4日 星期五

bad interpreter

http://eeepage.info/binshm-bad-interpreter-no-such-file-or-directory/

在Linux中執行.sh腳本
異常/bin/sh^M: bad interpreter: No such file or directory
分析:
這是不同系統編碼格式引起的:在windows系統中編輯的.sh文件可能有不可見字符,所以在Linux系統下執行會報以上異常信息。

解決:
1)在windows下轉換:
利用一些編輯器如UltraEdit或EditPlus等工具先將腳本編碼轉換,再放到Linux中執行。
轉換方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可

2)也可在Linux中轉換:
首先要確保文件有可執行權限
chmod a+x filename
然後修改文件格式
vi filename
利用如下命令查看文件格式
:set ff 或 :set fileformat
可以看到如下信息
fileformat=dos 或 fileformat=unix
利用如下命令修改文件格式
:set ff=unix 或 :set fileformat=unix
:wq (存檔退出)
最後再執行文件
./filename

2013年10月3日 星期四

Linux 修改MAC地址的四种方法介绍


http://www.zdh1909.com/html/Cisco/18632.html





方法一
1.关闭网卡设备 ifconfig eth0 down
2.修改MAC地址 ifconfig eth0 hw ether MAC地址
3.重启网卡 ifconfig eth0 up

方法二:
以上方法一修改后linux重启后MAC又恢复为原来的,为了下次启动时修改后的MAC仍有效,我们可以修改文件file:/etc/rc.d /rc.sysinit(RedFlag Linux为这个文件,其他版本的linux应该不同)的内容,在该文件末尾加以下内容:
ifconfig eth0 down
ifconfig eth0 hw ether MAC地址
ifconfig eth0 up
(此方法每次启动时都要寻找新硬件-网卡,不好用)  

方法三:
很简单的,只是在./etc/sysconfig/network-scripts/ifcfg-eth0中加入下面一句话: MACADDR=00:AA:BB:CC:DD:EE 并注释掉#HWADDR=语句

方法四:( = 方法一?)
暂时: Linux下的MAC地址更改

1.
首先用命令关闭网卡设备。
/sbin/ifconfig eth0 down

2.
然后就可以修改MAC地址了。
/sbin/ifconfig eth0 hw ether xxxxxxxxxxx (其中xx是您要修改的地址)

3.
最后重新启用网卡
/sbin/ifconfig eth0 up 网卡的MAC地址更改就完成了