標籤

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 (119) 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 (127) 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 (3) 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)

2014年8月22日 星期五

SQLCA.SQLCODE 和 SQLCA.SQLERRD 和 STATUS 錯誤碼查詢

http://4shiun.blogspot.tw/2013/04/sqlcasqlcode-sqlcasqlerrd-status.html

要判斷程式在執行的時候,SQL 指令回傳結果正確與否,
在 4GL 就提供以下三個變數來使用:

SQLCA.SQLCODE:
執行 SQL 指令後,回傳 Informix 4GL 所表示的 Error Code。

SQLCA.SQLERRD:
SQLERRD[1]~SQLERRD[6],SQLERRD[2] 表示資料庫的錯誤訊息,SQLERRD[3] 表示執行的 row 數,其他特別功能使用就不參考。

STATUS:
通常會等於 SQLCA.SQLCODE ,但是多了系統的錯誤碼,所以執行 SQL 指令後系統 I/O 錯誤時就會顯示另一個錯誤碼。

程式執行時會回傳 SQLCA.SQLCODE 訊息碼,有以下三種情況:
0 表示執行成功。
100 表示成功但無資料,所以當 Update 沒有符合條件的資料可以用。
<0 負數表示有錯誤。

當訊息碼為負數時,表示為錯誤訊息,但是我們要怎麼查是什麼錯誤,
只要在命令環境下,執行 finderr 錯誤碼 就會出現錯誤的說明了。

例:執行 finderr -201 會出現以下訊息,英文應該大概上就知道什麼涵義:
-201    A syntax error has occurred.

This is the general error code for all types of mistakes in the form of an SQL statement. Look for missing or extra punctuation (for example, missing or extra commas, omission of parentheses around a subquery, etc.), keywords misspelled (for example VALEUS for VALUES), keywords misused (for example, SET in an INSERT statement, INTO in a subquery), keywords out of sequence (for example a condition of "value IS NOT" instead of "NOT value IS"), or the use of a reserved word as an identifier.
Note: Database servers that support "full NIST compliance" do not reserve any words; queries that work with these database servers may fail with error -201 when used with earlier implementations.
不過因為 SQLCA.SQLCODE 是 Informix 在 4GL 所規範出來的錯誤訊息,所以比較籠統的方式來呈現,舉例 -201 表示語法錯誤,但是沒辦法詳細說明錯誤在那,因此在 Debug 時可以用 SQLERRD[2] 就可以知道 Oracle 的 ORA 的錯誤碼,比較快速的知道語法是那裡的錯誤。

要得知 SQL 執行的筆數 SQLCA.SQLERRD[3] 就可以知道 SQL 指令所處理的筆數,在程式上也可以多加利用。

另外 Genero 還有提供二個指令,要注意不是變數型態的 SQL Error Code 而是指令,所以 Debug 不能顯示內容,
要先 LET 到變數或是 DISPLAY 才看的到,也是可以參考使用,功能和 SQLERRD[2] 相同。

SQLSTATE:
回傳 ANSI SQLSTATE 錯誤碼,現在應該所有商用資料庫都有支援 ANSI SQL。

SQLERRMESSAGE:
回傳資料庫的錯誤碼和錯誤的說明。

2014年8月16日 星期六

2014年8月12日 星期二

vim search case-insensitive words 不分大小寫搜尋

http://untitled-c.blogspot.tw/2007/05/vim-search-case-insensitive-words.html

vim tip 再一發

取代的時候,要不分大小寫,可以用 s/aaa/bbb/i 。
那如果只是要搜尋,又要不分大小寫的時候呢?

直接在欲搜尋的字前面加上 \c 即可,
例如 /\cshrpoor ,會找到 Shrpoor、sHrpoor、shrpooR等等

2014年8月10日 星期日

PHP error log

兩種寫法:

1.利用error_log
 http://www.w3schools.com/php/func_error_log.asp

PHP error_log() Function


PHP Error Reference Complete PHP Error Reference

Definition and Usage

The error_log() function sends an error to the server error log, a file or a remote destination.
This funtion returns TRUE on success, or FALSE on failure.

Syntax

error_log(error,type,destination,headers)

Parameter Description
error Required. The error message to log
type Optional. Specifies the error log type.
Possible log types:
  • 0 - Default. The error is sent to the servers logging system or a file, depending on how the error_log configuration is set in the php.ini file
  • 1 - The error is sent by email to the address in the destination parameter. This message type is the only one that uses the headers parameter
  • 2 - The error is sent through the PHP debugging connection. This option is only available in PHP 3
  • 3 - The error is added to the file destination string
destination Optional. Specifies where to send the error message. The value of this parameter depends on the value of the "type" parameter
headers Optional. Only used if the "type" parameter is "1". Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n). Note: When sending an email, it must contain a From header. This can be set with this parameter or in the php.ini file.


Example

The following example sends an e-mail with a custom error:
<?php
$test=2;

if ($test>1)
{
error_log("A custom error has been triggered",
1,"someone@example.com","From: webmaster@example.com");
}
?>
The mail received from the code above looks like this:
A custom error has been triggered


PHP Error Reference Complete PHP Error Reference








2.自製 function
http://richile0819.blogspot.tw/2012/07/php-write-log-phplog.html 
 

function write_log($str,$status,$data_array)  //傳入資料夾名 想寫近的狀態 資料      
{

    $textname = $str.date("Ymd").".txt"; //檔名  filename
    $URL = "log/".$str."/";                         //路徑  Path
    if(!is_dir($URL))                                 // 路徑中的$str 資料夾是否存在 Folder exists in the path

        mkdir($URL,0700);
   
    $URL .= $textname;                           //完整路徑與檔名 The full path and filename

    $time = $str.$status.":".date("H:i:s"); //時間 Time
    $writ_tmp = '';
    foreach ($data_array as $key => $value) //將陣列資料讀出 To read array data
    {
       $writ_tmp .= ",".$key."=".$value;            
    }
    $write_data = $time.$writ_tmp."\n";
               
    $fileopen = fopen($URL, "a+");              
    fseek($fileopen, 0);
    fwrite($fileopen,$write_data);                 //寫資料進去 write data
    fclose($fileopen);

2014年8月7日 星期四

如何在 64 位元的 Windows 7 中安裝 PLSQL DEVELOPER 8 和 Oracle 11g x64 Client

http://support.microsoft.com/kb/2585547/zh-tw

Collapse image問題的來龍去脈

Win 7 X64 位元的環境安裝 PLSQL DEVELOPER 8Oracle 11g X64 Client(64位元)沒辦法順利安裝成功。

Collapse image問題的發生原因

整個問題是這樣的,PLSQL DEVELOPER 8 是沒辦法執行 64 位元的 OCI.DLL,可是 Win7 X64 又只能裝 64 位元 Oracle client X64
變成要多下載一個 Oracle Instant client X32,將裡頭的 OCI.DLL 指定給 PLSQL DEVELOPER 8,再設定一些環境變數,才能正常執行。

Collapse image問題的解決方法

以下是操作步驟:
  1. 先到 Oracle 官網下載 Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (x64) ,接者依照以下步驟安裝:

    a. 執行 win64_11gR2_client\client\setup.exe 進行安裝,一開始有個黑色偵測畫面,等消失後進入安裝畫面。
    b. 進入安裝畫面後,選您要安裝項目,這裡可以選【一般執行程式版本】安裝。


    2590712



    c. 【執行語言】用預設值:【繁體中文】、【英文】
    d. Oracle 基本目錄輸 入 D:\Oracl11_64


    2590713



    e. 接下來續按【下一步】一直到【完成】


    2590714

  2.  下載 PLSQL Developer 8 ,並解壓縮到特定目錄。
  3. Oracle官網下載Instant Client for Microsoft Windows (32-bit),選 instantclient-basic-nt-11.2.0.2.0.zip,下載後解壓縮instantclient_11_2到目錄D:\Oracl11_32 
  4. 進入【控制台】→【系統安全設定】→【系統】→【進階系統設定】,彈出以下視窗:


    2590120



    點選【環境變數】。


    2590121



    點使用者變數,點【編輯】進行修改。以下是要修改的環境變數 :

    變數名稱:TNS_ADMIN
    值: D:\Oracl11_64\product\11.2.0\client_1\network\admin

    變數名稱:NLS_LANG
    值:TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5 這值可以使用SQLPlus查詢,操作如下:
    a. 打開SQLPlus,輸入帳號:XX@DB字串,密碼:XXX。
    b. 輸入SQL指令:select userenv(‘language’) from dual

    變數名稱:PATH
    :加上 D:\Oracl11_32\instantclient_11_2,讓後面PLSQL Developer 8OCI Library設定能選到 oci.dll
  5. 進入【PLSQL Developer 8】→【Tools】→【preference】,修改 connection 設定:
    【Oracle_HOME】:指向 D:\Oracl11_32\instantclient_11_2
    【OCI】:點一下 OCI library 左邊黑框成綠框,指向 D:\Oracl11_32\instantclient_11_2\oci.dll 。


    2590123

  6. tnsnames.ora 複製到 D:\Oracl11_64\product\11.2.0\client_1\network\admin 路徑下。
  7. 重開 PLSQL Developer,就可以開始使用了。

2014年8月6日 星期三

VIM学习笔记 配色方案(Color Scheme)

http://yyq123.blogspot.tw/2011/02/vim-color-scheme.html

2011

VIM学习笔记 配色方案(Color Scheme)

识别背景色
Vim有两种显示模式:一种是背景为浅色,而另一种是背景为深色。在启动时,Vim会检测使用的是哪一种背景颜色,然后再应用语法高亮的配色方案。我们可以使用:set background?命令,查看当前使用的背景颜色。也可以使用:set background=light:set background=dark命令,来指定背景颜色。注意:必须在启用语法高亮之前,设置背景色彩。
使用配色方案
Vim如何使用不同颜色显示不同的语法元素是由配色方案(Color Scheme)定义的。输入:colorscheme命令,紧接着一个空格后,然后点击Tab键,将可以遍历所有已安装的配色方案,按下Enter键就可以应用该配色方案。
安装配色方案
你可以先在Vim Color Scheme Test网站中,预览各种配色方案的效果,然后再点击配色方案的名称进行下载安装。
ColorScheme_Test
你也可以在Vim.org中,查找并下载喜欢的配色方案。你甚至可以下载Color Sampler Pack,然后从其中包含的100个最受欢迎配色方案里慢慢挑选。
将下载的配色方案文件name.vim,放入$VIMRUNTIME/colors目录中;然后执行以下命令,就可以应用这个配色方案了:
:colorscheme name
修改配色方案
我们可以使用:highlight命令,查看当前的配色设定。
highlight
如果对现在的语法配色不满意,可以使用以下命令进行修改:
:highlight group definition
其中group是指语法元素,例如:
  • Cursor,光标下的字符
  • Directory,目录名称
  • ErrorMsg,在最底行显示的错误信息
  • IncSearch,增量(Incremental)查找的匹配结果
  • ModeMsg,在左下角显示的模式名称
  • MoreMsg,显示更多信息时的提示
  • Visual,在可视化模式下被选中的文本
使用以下命令,可以查看关于group的帮助信息:
:help group-name
definition是指具体定义。例如以下命令,将定义黄底黑字的终端:
:highlight Normal ctermfg=black ctermbg=yellow
在命令中没有指定的参数,将保持其原有的定义。例如以下命令,将背景定义为白色,而前景颜色不变:
:highlight Normal\ ctermbg=white
Vim识别三种不同的终端:term,黑白终端;cterm,彩色终端;gui,Gvim窗口。
term,可以定义其字体显示为:bold、underline、reverse、italic或standout。例如以下命令,用逗号来组合使用这些属性:
:highlight Keyword term=reverse,bold
cterm,可以用ctermfg设置前景色;用ctermbg设置背景色。例如以下命令,定义蓝底红字并使用下划线来显示注释:
:highlight Comment cterm=underline ctermfg=red ctermbg=blue
gui,可以使用选项gui=attribute,来定义图形窗口下语法元素的显示属性。选项guifgguibg,用来定义了前景色和背景色。推荐使用的颜色包括:black, brown, grey, blue, green, cyan, magenta, yellow, white。
为了保持各平台下的一致性,我们应该使用十六进制颜色代码来指定颜色。例如使用以下命令,一次定义几种终端下的配色:
:highlight Error term=reverse cterm=blod ctermfg=#00afff ctermbg=#a8a8a8
利用hexHighlight.vim插件可以直观的查看配色:点击\F2键,就可以将十六进制颜色代码显示为真实的色彩;再次点击\F2键,则将色彩还原显示为字符。
plugin_hexHighlight
注意:此插件仅适用于Gvim。
命令小结
:set background设置背景颜色
:colorscheme设置配色方案
:highlight定义高亮显示

2014年8月5日 星期二

tiptop:呼叫SQL and DATE 轉換STRING


 
DEFINE p_date  DATE
DEFINE s_date  VARCHAR(10)

LET s_date = g_oea.oea02 USING "yyyy/mm/dd"
PREPARE s2 FROM "select ds.axmt410.get_oeb15(?,?) from dual"
EXECUTE s2 USING g_oea.ta_oea07,s_date INTO p_date
FREE s2


(axmt410.get_oeb15的參數都是VARCHAR2)