標籤

4GL (1) 人才發展 (10) 人物 (3) 太陽能 (4) 心理 (3) 心靈 (10) 文學 (31) 生活常識 (14) 光學 (1) 名句 (10) 即時通訊軟體 (2) 奇狐 (2) 爬蟲 (1) 音樂 (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) Fedora (1) FI (57) File Transfer (1) Firefox (3) FM (2) fourjs (1) Genero (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 (4) JavaScript (22) jQuery (6) JSON (1) K3b (1) ldd (1) LED (3) Linux (117) Linux Mint (4) Load Balance (1) Microsoft (2) MIS (2) MM (51) MSSQL (1) MySQL (27) Network (1) NFS (1) Office (1) OpenSSL (1) Oracle (126) Outlook (3) PDF (6) Perl (60) PHP (33) PL/SQL (1) PL/SQL Developer (1) PM (3) Postfix (2) postfwd (1) PostgreSQL (1) PP (50) python (5) QM (1) Red Hat (4) Reporting Service (28) ruby (11) SAP (234) scp (1) SD (16) sed (1) Selenium (3) Selenium-WebDriver (5) shell (5) SQL (4) SQL server (8) sqlplus (1) SQuirreL SQL Client (1) SSH (2) SWOT (3) Symantec (2) T-SQL (7) Tera Term (2) tip (1) tiptop (24) Tomcat (6) Trouble Shooting (1) Tuning (5) Ubuntu (37) ufw (1) utf-8 (1) VIM (11) Virtual Machine (2) VirtualBox (1) vnc (3) Web Service (2) wget (1) Windows (19) Windows (1) WM (6) Xvfb (2) youtube (1) yum (2)

2015年7月28日 星期二

MySQL時間相減,使用timestampdiff (Table schema is DataTime)

http://dreamtails.pixnet.net/blog/post/27976134-mysql%E6%99%82%E9%96%93%E7%9B%B8%E6%B8%9B,%E4%BD%BF%E7%94%A8timestampdiff-%28table-schema-is-datat

表格名稱為TimeTable.
分別有兩個columns,一個是downTime,一個是upTime.

而我們是以"分" minute來作輸出的單位, 也可使用"小時" hour為單位,或是"秒" second, "天" day, "月" month"年" year.

mysql> select timestampdiff(minute,`downTime`,`upTime`) as Subtract from TimeTable;

基於不同營運中心,修改登入的UI background color

1. tiptop style file : /u1/topprod/tiptop/config/4st/tiptop.4st
    新增/修改這裡的style,例如
<Style name="Window.echo02" >
   <StyleAttribute name="startMenuPosition" value="menu" />
   <StyleAttribute name="ringMenuPosition" value="right" />
   <StyleAttribute name="toolBarPosition" value="top" />
   <StyleAttribute name="actionPanelPosition" value="right" />
   <StyleAttribute name="backgroundColor" value="lightCyan" />
</Style>

2. 修改lib/4gl/cl_setup.4gl
(因為程式OPEN WINDOW 時,都用g_win_style,本來cl_setup都是去抓zz_file.zz27,這裡把它半路攔截)
#20150630-1 BEGIN
   IF g_plant = "ECHO01" THEN
      LET g_win_style = "echo01"
   END IF
   IF g_plant = "ECHO02" THEN
      LET g_win_style = "echo02"
   END IF
   IF g_plant = "ECHO03" THEN
      LET g_win_style = "echo03"
   END IF
#20150630-1   END

安裝 PHP/oci8/mysqli

1. OS version
[root@EIP-API-AP php-5.2.17]# lsb_release -a
LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.2 (Final)
Release:        6.2
Codename:       Final
2. Apache version
[root@EIP-API-AP php-5.2.17]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Oct 16 2014 14:48:21
3. PHP version
php-5.2.17
4. 拿掉/安裝 不要service
chkconfig iptables off
chkconfig postfix off
yum install vsftpd.x86_64 (vim /etc/vsftp/vsftpd.conf --> userlist_deny=NO)
5. OS command
yum install httpd-devel
yum install gcc
yum install libxml2-devel
yum install mysql-devel
yum install autoconf
cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so
./configure --with-apxs2=/usr/sbin/apxs --with-mysql
make
make test
make install
cp php.ini-recommended /usr/local/lib/php.ini

6. vim httpd.conf
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>
7. vim php.ini
short_open_tag=on (這樣<% 才認得,否則只能用 <?php)
8. OS command
service httpd restart
9. install oracle instant client
rpm -U oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
rpm -U oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
10. download oci8
ln -s /usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1 /usr/lib/oracle/12.1/client64/lib/libclntsh.so
tar zxvf oci8-2.0.8.tgz
cd oci8-2.0.8
phpize
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/12.1/client64/lib
make
make install
11. vim /usr/local/lib/php.ini
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
extension=oci8.so
12. service httpd restart
13. mysqli installation
cd ~/Downloads/php-5.2.17/ext/mysqli/
phpize
./configure --prefix=/usr/local/mysqli --with-php-config=/usr/local/bin/php-config --with-mysqli=/usr/bin/mysql_config
make
make install
vim /usr/local/lib/php.ini (extension=mysqli.so)
14. phpinfo
check if oci8 installed

Reporting Service 連結 Oracle 出現 rsErrorOpeningConnection

裝好Oracle Client後:
1. 設定環境變數ORACLE_HOME
2. 重開IIS Admin Service

從Oracle寫到MySQL時,中文變成亂碼

原因:
SHOW FULL COLUMNS FROM IMA_FILE;
可以看到 latin1_swedish_ci
+-----------+---------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| Field     | Type          | Collation         | Null | Key | Default | Extra | Privileges                      | Comment |
+-----------+---------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| ima01     | varchar(40)   | utf8_unicode_ci   | YES  | MUL | NULL    |       | select,insert,update,references |         |
| IMA02     | varchar(60)   | latin1_swedish_ci | YES  |     | NULL    |       | select,insert,update,references |         |
| ima021    | varchar(60)   | utf8_unicode_ci   | YES  |     | NULL    |       | select,insert,update,references |         |
| IMA03     | varchar(20)   | latin1_swedish_ci | YES  |     | NULL    |       | select,insert,update,references |         |
...

這是亂碼的原因,改成utf8_unicode_ci


作法:
alter table IMA_FILE modify imaud02 varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

如何在外部網頁redirect到內部網頁後,下載doc文件

在外網的/distributor/import_doc_download.php

header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $docno);
ob_clean();
flush();

readfile('http://10.1.100.101/cgi-bin/fglccgi/topprod/topcust/help/0/aim/download_doc/' . $docno);
 

NFS installation

 yum install nfs
service nfs start
chkconfig nfs on
mkdir /nfsshare
vim /etc/exports
------------------------
/nfsshare       192.168.0.0/255.255.255.0(ro,sync)
------------------------
service nfs restart
showmount -e 本機IP

新增帳號同時新增密碼

例:帳號abc, 密碼123
useradd abc && echo '123' | passwd abc --stdin

4gl.vim

放在$HOME/.vim

" Vim syntax file
" Language:     Informix 4GL
" Maintainer:   Rafal M. Sulejman <rms@poczta.onet.pl>
" Update:       26 Sep 2002
" Changes:
" - Dynamic 4GL/FourJs/4GL 7.30 pseudo comment directives (Julian Bridle)
" - Conditionally allow case insensitive keywords (Julian Bridle)
"
" Changed by: Timothy Kim <cool.msg@hotamil.com>
" Update:     23 Nov 2008
" Changes:
" - Added syntax folding

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

let b:fgl_minlines = 200
exec "syn sync ccomment cComment minlines=" . b:fgl_minlines

syntax case ignore
syn keyword fglKeyword ABORT ABS ABSOLUTE ACCEPT ACCESS ACOS ADD AFTER ALL
syn keyword fglKeyword ALLOCATE ALTER AND ANSI ANY APPEND ARG_VAL ARRAY ARR_COUNT
syn keyword fglKeyword ARR_CURR AS ASC ASCENDING ASCII ASIN AT ATAN ATAN2 ATTACH
syn keyword fglKeyword ATTRIBUTE ATTRIBUTES AUDIT AUTHORIZATION AUTO AUTONEXT AVERAGE AVG
syn keyword fglKeyword BEFORE BEGIN BETWEEN BLACK BLINK BLUE BOLD BORDER BOTH BOTTOM
syn keyword fglKeyword BREAK BUFFERED BY BYTE
syn keyword fglKeyword CALL CASCADE CASE CHAR CHARACTER CHARACTER_LENGTH CHAR_LENGTH
syn keyword fglKeyword CHECK CLASS_ORIGIN CLEAR CLIPPED CLOSE CLUSTER COLOR
syn keyword fglKeyword COLUMN COLUMNS COMMAND COMMENT COMMENTS COMMIT COMMITTED
syn keyword fglKeyword COMPOSITES COMPRESS CONCURRENT CONNECT CONNECTION
syn keyword fglKeyword CONNECTION_ALIAS CONSTRAINED CONSTRAINT CONSTRAINTS CONSTRUCT
syn keyword fglKeyword CONTINUE CONTROL COS COUNT CREATE CURRENT CURSOR CYAN
syn keyword fglKeyword DATA DATABASE DATASKIP DATE DATETIME DAY DBA DBINFO DBSERVERNAME
syn keyword fglKeyword DEALLOCATE DEBUG DEC DECIMAL DECLARE DEFAULT DEFAULTS DEFER
syn keyword fglKeyword DEFERRED DEFINE DELETE DELIMITER DELIMITERS DESC DESCENDING
syn keyword fglKeyword DESCRIBE DESCRIPTOR DETACH DIAGNOSTICS DIM DIRTY DISABLED
syn keyword fglKeyword DISCONNECT DISPLAY DISTINCT DISTRIBUTIONS DO DORMANT DOUBLE
syn keyword fglKeyword DOWN DOWNSHIFT DROP
syn keyword fglKeyword EACH ELIF ELSE ENABLED END ENTRY ERROR ERRORLOG ERR_GET
syn keyword fglKeyword ERR_PRINT ERR_QUIT ESC ESCAPE EVERY EXCEPTION EXCLUSIVE
syn keyword fglKeyword EXEC EXECUTE EXISTS EXIT EXP EXPLAIN EXPRESSION EXTEND EXTENT
syn keyword fglKeyword EXTERN EXTERNAL
syn keyword fglKeyword F1 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F2 F20 F21 F22 F23
syn keyword fglKeyword F24 F25 F26 F27 F28 F29 F3 F30 F31 F32 F33 F34 F35 F36 F37 F38
syn keyword fglKeyword F39 F4 F40 F41 F42 F43 F44 F45 F46 F47 F48 F49 F5 F50 F51 F52
syn keyword fglKeyword F53 F54 F55 F56 F57 F58 F59 F6 F60 F61 F62 F63 F64 F7 F8 F9
syn keyword fglKeyword FALSE FETCH FGL_GETENV FGL_KEYVAL FGL_LASTKEY FIELD FIELD_TOUCHED
syn keyword fglKeyword FILE FILLFACTOR FILTERING FINISH FIRST FLOAT FLUSH FOR
syn keyword fglKeyword FOREACH FOREIGN FORM FORMAT FORMONLY FORTRAN FOUND FRACTION
syn keyword fglKeyword FRAGMENT FREE FROM FUNCTION GET_FLDBUF GLOBAL GLOBALS GO GOTO
syn keyword fglKeyword GRANT GREEN GROUP HAVING HEADER HELP HEX HIDE HIGH HOLD HOUR
syn keyword fglKeyword IDATA IF ILENGTH IMMEDIATE IN INCLUDE INDEX INDEXES INDICATOR
syn keyword fglKeyword INFIELD INIT INITIALIZE INPUT INSERT INSTRUCTIONS INT INTEGER
syn keyword fglKeyword INTERRUPT INTERVAL INTO INT_FLAG INVISIBLE IS ISAM ISOLATION
syn keyword fglKeyword ITYPE
syn keyword fglKeyword KEY LABEL
syn keyword fglKeyword LANGUAGE LAST LEADING LEFT LENGTH LET LIKE LINE
syn keyword fglKeyword LINENO LINES LOAD LOCATE LOCK LOG LOG10 LOGN LONG LOW
syn keyword fglKeyword MAGENTA MAIN MARGIN MATCHES MAX MDY MEDIUM MEMORY MENU MESSAGE
syn keyword fglKeyword MESSAGE_LENGTH MESSAGE_TEXT MIN MINUTE MOD MODE MODIFY MODULE
syn keyword fglKeyword MONEY MONTH MORE
syn keyword fglKeyword NAME NCHAR NEED NEW NEXT NEXTPAGE NO NOCR NOENTRY NONE NORMAL
syn keyword fglKeyword NOT NOTFOUND NULL NULLABLE NUMBER NUMERIC NUM_ARGS NVARCHAR
syn keyword fglKeyword OCTET_LENGTH OF OFF OLD ON ONLY OPEN OPTIMIZATION OPTION OPTIONS
syn keyword fglKeyword OR ORDER OTHERWISE OUTER OUTPUT
syn keyword fglKeyword PAGE PAGENO PAUSE PDQPRIORITY PERCENT PICTURE PIPE POW PRECISION
syn keyword fglKeyword PREPARE PREVIOUS PREVPAGE PRIMARY PRINT PRINTER PRIOR PRIVATE
syn keyword fglKeyword PRIVILEGES PROCEDURE PROGRAM PROMPT PUBLIC PUT
syn keyword fglKeyword QUIT QUIT_FLAG
syn keyword fglKeyword RAISE RANGE READ READONLY REAL RECORD RECOVER RED REFERENCES
syn keyword fglKeyword REFERENCING REGISTER RELATIVE REMAINDER REMOVE RENAME REOPTIMIZATION
syn keyword fglKeyword REPEATABLE REPORT REQUIRED RESOLUTION RESOURCE RESTRICT
syn keyword fglKeyword RESUME RETURN RETURNED_SQLSTATE RETURNING REVERSE REVOKE RIGHT
syn keyword fglKeyword ROBIN ROLE ROLLBACK ROLLFORWARD ROOT ROUND ROW ROWID ROWIDS
syn keyword fglKeyword ROWS ROW_COUNT RUN
syn keyword fglKeyword SCALE SCHEMA SCREEN SCROLL SCR_LINE SECOND SECTION SELECT
syn keyword fglKeyword SERIAL SERIALIZABLE SERVER_NAME SESSION SET SET_COUNT SHARE
syn keyword fglKeyword SHORT SHOW SITENAME SIZE SIZEOF SKIP SLEEP SMALLFLOAT SMALLINT
syn keyword fglKeyword SOME SPACE SPACES SQL SQLAWARN SQLCA SQLCODE SQLERRD SQLERRM
syn keyword fglKeyword SQLERROR SQLERRP SQLSTATE SQLWARNING SQRT STABILITY START
syn keyword fglKeyword STARTLOG STATIC STATISTICS STATUS STDEV STEP STOP STRING STRUCT
syn keyword fglKeyword SUBCLASS_ORIGIN SUM SWITCH SYNONYM SYSTEM
syn keyword fglKeyword SysBlobs SysChecks SysColAuth SysColDepend SysColumns
syn keyword fglKeyword SysConstraints SysDefaults SysDepend SysDistrib SysFragAuth
syn keyword fglKeyword SysFragments SysIndexes SysObjState SysOpClstr SysProcAuth
syn keyword fglKeyword SysProcBody SysProcPlan SysProcedures SysReferences SysRoleAuth
syn keyword fglKeyword SysSynTable SysSynonyms SysTabAuth SysTables SysTrigBody
syn keyword fglKeyword SysTriggers SysUsers SysViews SysViolations
syn keyword fglKeyword TAB TABLE TABLES TAN TEMP TEXT THEN THROUGH THRU TIME TO
syn keyword fglKeyword TODAY TOP TOTAL TRACE TRAILER TRAILING TRANSACTION TRIGGER
syn keyword fglKeyword TRIGGERS TRIM TRUE TRUNC TYPE TYPEDEF
syn keyword fglKeyword UNCOMMITTED UNCONSTRAINED UNDERLINE UNION UNIQUE UNITS UNLOAD
syn keyword fglKeyword UNLOCK UNSIGNED UP UPDATE UPSHIFT USER USING
syn keyword fglKeyword VALIDATE VALUE VALUES VARCHAR VARIABLES VARIANCE VARYING
syn keyword fglKeyword VERIFY VIEW VIOLATIONS
syn keyword fglKeyword WAIT WAITING WARNING WEEKDAY WHEN WHENEVER WHERE WHILE WHITE
syn keyword fglKeyword WINDOW WITH WITHOUT WORDWRAP WORK WRAP WRITE
syn keyword fglKeyword YEAR YELLOW
syn keyword fglKeyword ZEROFILL
syn keyword personal TIMK

" Strings and characters:
syn region fglString            start=+"+  skip=+\\\\\|\\"+  end=+"+
syn region fglString            start=+'+  skip=+\\\\\|\\"+  end=+'+

" Numbers:
syn match fglNumber             "-\=\<[0-9]*\.\=[0-9_]\>"

" Comments:
syn region fglComment    start="{"  end="}"
syn match fglComment    "--.*"
syn match fglComment    "#.*"

" Not a comment even though it looks like one (Dynamic 4GL/FourJs directive)
syn match fglSpecial    "--#"
syn match fglSpecial    "--@"

syn sync ccomment fglComment


syn cluster NofglFold contains=fglComment,fglString

"function
syn region FglFunctionFold
      \ start="^\s*function .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end function.*$"
      \ transparent fold
      \ keepend extend
      \ contains=ALLBUT, @NoFglFold

"case  -----------------------------------------"
syn region FglCaseFold
      \ start="^\s*case[ .]*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end case"
      \ transparent fold
      \ keepend extend
      \ containedin=ALLBUT, @NoFglFold

"when|otherwise"
syn region fglWhenFold
      \ start="^\s*\(when .*\|otherwise\)\s*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*\(when .*\|otherwise\|end case\)\s*$"ms=s-1,me=s-1
      \ transparent fold
      \ keepend
      \ containedin=FglCaseFold

"while --------------------------------------------"
syn region FglWhileFold
      \ start="^\s*while .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end while"
      \ transparent fold
      \ keepend extend
      \ containedin=ALLBUT, @NoFglFold
"for"
syn region FglForFold
      \ start="^\s*for .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end for"
      \ transparent fold
      \ keepend extend
      \ containedin=ALLBUT, @NoFglFold
"foreach"
syn region FglForeachFold
      \ start="^\s*foreach .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end foreach"
      \ transparent fold
      \ keepend extend
      \ containedin=ALLBUT, @NoFglFold

"if container -------------------------------------"
syn region fglIfFoldContainer
      \ start="^\s*if .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end\s*if"
      \ transparent fold
      \ keepend extend
      \ containedin=ALLBUT, @NoFglFold
      \ contains=TOP

""if"
syn region fglIfFold
      \ start="^\s*if .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*else"ms=s-1,me=s-1
      \ transparent fold
      \ keepend
      \ contained containedin=fglIfFoldContainer
      \ nextgroup=fglFoldElse
      \ contains=TOP

"else"
syn region fglFoldElse
      \ start="^\s*else"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end\s*if"ms=s-1,me=s-1
      \ transparent fold
      \ keepend
      \ contained containedin=fglIfFoldContainer
      \ contains=TOP

"input  ----------------------------------------------"
syn region fglInputFold
      \ start="^\s*input .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end\s*input"
      \ transparent fold
      \ keepend extend
      \ containedin=ALLBUT, @NoFglFold

"before|after|on"
syn region fglInputSubGrpFold
      \ start="^\s*\(before\|after\|on\) .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*\(before \|after \|on \|end input\).*\s*$"ms=s-1,me=s-1
      \ transparent fold
      \ keepend
      \ containedin=FglInputFold

syn region fglDisplaySubGrpFold
      \ start="^\s*\(before\|after\|on\) .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*\(before \|after \|on \|end display\).*\s*$"ms=s-1,me=s-1
      \ transparent fold
      \ keepend
      \ containedin=FglFunctionFold

"report ----------------------------------------------"
syn region FglReportFold
      \ start="^\s*report .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end report.*$"
      \ transparent fold
      \ keepend extend
      \ contains=ALLBUT, @NoFglFold

syn region fglReportSubGrpFold
      \ start="^\s*\(before\|after\|on\|page\|first\|last\) .*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*\(before\|after\|on\|page\|first\|last\|end\) .*\s*$"ms=s-1,me=s-1
      \ transparent fold
      \ keepend
      \ containedin=FglReportFold
      \ contains=TOP

""define  ---------------------------------------------"
syn region fglDefineFold
      \ start="^\s*define.*$"
      \ end="^\s*$"
      \ transparent fold
      \ keepend

"globals"
syn region FglGlobalsFold
      \ start="^\s*globals\s*$"
      \ skip=/^\s*\(#.*\)*$/
      \ end="^\s*end globals\s*$"
      \ transparent fold
      \ keepend
      \ contains=fglDefineFold
      \ containedin=NONE

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_fgl_syntax_inits")
  if version < 508
    let did_fgl_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink fglComment     Comment
  "HiLink fglKeyword    fglSpecial
  HiLink fglKeyword     fglStatement
  HiLink fglNumber      Number
  HiLink fglOperator    fglStatement
  HiLink fglSpecial     Special
  HiLink fglStatement   Statement
  HiLink fglString      String
  HiLink fglType        Type

  delcommand HiLink
endif

let b:current_syntax = "fgl"

" vim: ts=8

hi fglKeyword guifg=red

.vimrc

放在$HOME
set t_Co=256
" colorscheme default
" colorscheme desert
" colorscheme darkblue
colorscheme elflord
" colorscheme torte
set term=ansi
syntax on
set nu
" set autoindent

" let syntaxfile = "$HOME/.vim/4gl.vim"
" syntax on

2015年7月26日 星期日

領導者的責任

http://opinion.udn.com/opinion/story/6777/1081564

領導者的責任就是團結被領導的人。
這篇文章就是這樣,把結論說在第一句,因為這一句實在是太重要。如果不放在第一句,大家就很容易被其他東西引走。以為這文章在說的是其他東西,所以請重複看完第一句,這是這篇文章的結論,甚至說,如果你已認同這就是答案,你不需要看下去。
要這樣說的原因,在於領導者的責任太多,領導者其實就是「做所有團隊裡沒有人做的事的人」,上至決策,指揮,提升士氣,維持補給,下至所有基層的工作,舉個例子說,一個小公司的老闆,沒錢請人倒垃圾,所以他應該做些甚麼?就是自己去倒垃圾。
無論是多大的組織,從足球隊,小企業,去到大企業,整個國家,每個群體都會有人願意負責某個部份。剩下的,全都是領導者的事情。
因此談及領導者的責任時,大家容易把其中一個領導的事情,當成最重要的。比方說,認為領導者最需要做出明智的戰略,認為領導者最需要有錢,認為領導者要勤 力,認為領導者要清廉等。並不是說領導者並不需要這樣,這些東西,每一個都重要而且致命,但當中最致命,最重要的是甚麼?
其他事情就像手腳肝腎心臟一樣重要,但沒手再不方便也不會立即死亡,即使心臟有問題,還是有辦法可以移植,去不到腦袋那樣完全不可代替。而「團結被領導的人」就像腦袋,沒有任何一點比這點更重要。
領導者無法團結被領導的人,就算決策再明智,底下的人也不服,陽奉陰違甚至刻意妨礙。再清廉,底下的人也沒有被感動而以權謀私。再勤力,底下的人也欠缺勤力。
而再徹底一點說,底下的群體內鬥和分裂,甚至土崩瓦解,領導者就像是群體的黏著劑,就算是完全同一群人,領導者的品質決定了這群人的體質。不好的領導者帶著一群驕傲的優質人才,反而會因為誰都不服誰而走向內鬨。

photo cedit:Olivier Carré-Delisle(CC BY-ND 2.0)

分享
我們常常說華人不團結,但這句其實是本末倒置的,因為會導致這情況,是站在應是領導位置的人,令被領導的人團結失敗了。當大家根本不同意領導者,不服領導 者,不信任領導者,討厭和鄙視領導者,這樣還有甚麼可能團結呢?人不可能為團結而團結,人只會為人覺得值得的東西而團結。
去到最後,往往從領導者,淪為「統治者」,就是去到根本失去了團結的能力,也不去做領導這個行為。單純用命令,用威脅,用強迫。例如用員工不跟你打工,就 沒飯吃,結果再討厭你也必須幫你打工,用這樣的方式,才能夠勉強把組織維持下來,這樣當然團結程度是零了,因為員工隨時都想離開,他們只是無法離開,再跟 他們談團結,當然是徒然。
人類歷史去到今天為止,並沒有任何領導者,能夠有辦法,令所有人都團結,令所有人都心服。但是領導者之間還是有品質的分別,就是他底下的人,因為「心服」而團結的比例多,還是因為接受而「屈服」的人比例多。前者比例越高,就是越成功的領導者。
領導跟統治的關係,就是太陽與北風的關係,雖然北風與和太陽,目標都是一樣,就是讓別人脫下衣服。北風的方法是強迫,但會引起對方的對抗,北風需要更大的 力量強行把衣服吹走。而太陽的方法是製造氣氛環境出來,令對方自願把衣服脫下來,同一個目標,可以有完全不同的實現方法。
去到國家的總統時,也是是完全一樣的,這點的優劣,是之後所有其他事情的基礎。而這,其實是很看領導者本身,對於自己所領導的人,是否有一個全面的體認。 先團結自己的團隊,再團結自己的支持者,進而試圖團結整個國家的人,沒可能完全做好,但領導者必須清楚,這才是最重要的責任。

2015年7月16日 星期四

物料分类账的基本原理

http://www.wysap.com/xuexi/material/20130621/1863.html

物料分类账的基本原理

作者:SAP中文学习网 
 
      物料账(英文缩写ML)是按照物料的实际流向来分摊差异的,它支持每月物料收支业务采用标准价,期末核算物料的实际成本。即在月内每天出、入库业务采用标准价记帐,期末计算物料实际成本并重估库存值。

      物料分类账例子:

      1.这里假设有个原料(ROM)标准价格为10;期初数量为80
 
      2.本月入库为20个,单价为12,这是系统按标准价记录库存价值增加(20*10)200元;同时在物料账中记录该物料产生的差异为40

      3.假设出库50个,系统按标准价格记录材料消耗(50*10)500元;

      4.此时期末库存为50

      5.在期末做该物料单层评估时,系统将将步骤2产生的40元的差异在本期消耗(步骤2消耗的50个)和期末库存间分摊(50个)。所以将20元的差异分给该原料的存货价值,同时将20元的差异分给使用该原料的半成品(WIP)

      6.同样该半成品(wip)接收了20元的差异,该半成品在月底也要将差异在期末库存和本月消耗直接分配。

 
     物料帐的目的


     用物料帐的目的就是为了在月底能得到实际的生产成本,包括外购和自制材料的实际成本。

     此外,物料帐能利用实际成本来评估原材料、半成品和产品的实际库存结余;也就是说基于当月物流来计算出每个物料的当月实际期间单价。

      物料账是首先基于当月的标准单价来评估所有的货物移动,同时,所有物料的价格差异和汇率差异收集在物料帐上。每个月末,基于当月的实际单价来重估当月的库存,同时此实际单价可以当作下个月的标准单价。

2015年7月6日 星期一

砍錯資料時,將已經delete 資料救回來

SELECT * FROM tc_ctr02_file AS OF TIMESTAMP
   TO_TIMESTAMP('2015-07-07 09:30:00', 'YYYY-MM-DD HH:MI:SS')

2015年7月5日 星期日

在CONSTRUCT 時,如何讀到正在輸入的欄位值?( 在AFTER FIELD 使用 FGL_DIALOG_GETBUFFER() )

 ######方法ㄧ######
 235        CONSTRUCT tm.wc3 ON oma03,tmp,tmp3 FROM occ01_in,tax_type,deliv_date
 236           ON ACTION CONTROLP    #FUN-4B0043
 237              IF INFIELD(occ01_in) THEN
 238                 CALL cl_init_qry_var()
 239                 LET g_qryparam.form = "q_occ"
 240                 LET g_qryparam.state = "c"
 241                 CALL cl_create_qry() RETURNING g_qryparam.multiret
 242                 DISPLAY g_qryparam.multiret TO occ01_in
 243                 NEXT FIELD occ01_in
 244              END IF
 245           AFTER FIELD occ01_in
 246              IF g_imd.invoice_type = "1" THEN
 247                 LET g_imd.occ01_in = FGL_DIALOG_GETBUFFER()
 248                 SELECT occ41 INTO g_imd.tax_type FROM occ_file WHERE occ01 = g_imd.occ01_in
 249                 DISPLAY BY NAME g_imd.tax_type
 250              END IF
 251           AFTER FIELD deliv_date
 252              SELECT sma53 INTO l_sma53 FROM sma_file
 253              LET g_imd.deliv_date = FGL_DIALOG_GETBUFFER()
 254              IF g_imd.deliv_date < l_sma53 THEN
 255                 CALL cl_err("該日期已經結帳,不可出貨","PL0000",1)
 256                 NEXT FIELD CURRENT
 257              END IF
 258        END CONSTRUCT

 ######方法二######
2124       ON ACTION accept
2125          IF l_tc_sds.tc_sds01 IS NULL  THEN
2126             #LET l_tc_sds.tc_sds01 = fgl_dialog_getbuffer()
2127             LET l_tc_sds.tc_sds01 = GET_FLDBUF(tc_sds01)
2128          END IF
2129          IF l_tc_sds.tc_sds02 IS NULL  THEN
2130             #LET l_tc_sds.tc_sds02 = fgl_dialog_getbuffer()
2131             LET l_tc_sds.tc_sds02 = GET_FLDBUF(tc_sds02)
2132          END IF
2133          IF l_tc_sds.tc_sds07 IS NULL  THEN
2134             #LET l_tc_sds.tc_sds07 = fgl_dialog_getbuffer()
2135             LET l_tc_sds.tc_sds07 = GET_FLDBUF(tc_sds07)
2136          END IF
2137          IF l_tc_sds.tc_sds122 IS NULL  THEN
2138             #LET l_tc_sds.tc_sds122 = fgl_dialog_getbuffer()
2139             LET l_tc_sds.tc_sds122 = GET_FLDBUF(tc_sds122)
2140          END IF