2015年9月14日 星期一

4GL 日期的運算

日期1-日期2 = 幾天
在 IBM Genero 4GL 程式語言中. 日期的運算可真是.不好用
以下程式代碼看看. 看不懂我也無法救你了.
注意. 在資料中通常我們會用   l_d1 like  abc_table.date01 方式來宣告變數. 可是在作運算時他很白痴的不會自動轉方Datetime 再作運算 所以我會先把資料庫欄位先存到我自己的變數 如下 l_d1 datetime year to day 這樣在作運算時比較不會出錯. 一出錯 你的 l_i1 就一定是 NULL 值


 
  define l_d1 datetime year to day
  define l_d2 datetime year to day
  define l_i1 interval day(5) to day
  define l_l2 interval month to month
  let l_d1 = '2002-01-01'
  let l_d2 = '2015-09-01'
  let l_i1=  l_d2-l_d1
  display  l_i1
  let l_l2 = interval(1) month to month
  let l_d1 = l_d1 +  interval(1) month to month    #加一個月的日期
  let l_d1 = l_d1 -  interval(1) month to month    #減一個月的日期
  let l_d1 = l_d1 +  interval(1) year to year    #加一個年的日期
 
 
  if l_i1 > interval(365) day(5) to day then    #判斷式的用法
    display "over 1 year"
  else
    display "Yes 1 year"   
  end if

2015年8月20日 星期四

disk2vhd 的VHD 放到HYPER-V 無法開機


  1. 找出這系統的安裝CD,
    1.開機進安裝畫面
    2.選好 語言, KEY BOARD 等等. next
    3.repair your computer.. next
    4. command prompt . 命令字元
    5. bootrec /fixmbr
    bootrec /fixboot
    bootrec /scanos
    exit
    rebot

    如果第5項還作了還是進不了.
    請改用
    bootrec /rebuildbcd
    exit
     

2015年7月28日 星期二

單獨COMPILE RESOURCE.

請用  vs.net XXXX 命令提示字元 進入DOS 模式


單一COMPILE 各RESOURCE

resgen.exe /compile FRM_SALE001.en-US_BK.resx,GWStockWin.SALE.FRM_SALE001.en-US.resources
resgen.exe /compile FRM_SALE002.en-US.resx,GWStockWin.SALE.FRM_SALE002.en-US.resources
resgen.exe /compile FRM_SALE003.en-US.resx,GWStockWin.SALE.FRM_SALE003.en-US.resources



把所有RESOURCE 組成 resource.dll

Al.exe /t:lib /embed:GWStockWin.SALE.FRM_SALE001.en-US.resources /embed:GWStockWin.SALE.FRM_SALE002.en-US.resources /embed:GWStockWin.SALE.FRM_SALE003.en-US.resources /culture:"en-US" /out:"GWStockWin.resources.dll"

2015年5月14日 星期四

ORACLE 查所值 在所有資料庫中那些欄位出現過,

DECLARE
  match_count integer;
  v_search_string varchar2(4000) :='%MYSTR%';
BEGIN 
  FOR t IN (SELECT owner, table_name, column_name FROM all_tab_columns WHERE DATA_TYPE ='CHAR' ) LOOP  
    EXECUTE IMMEDIATE   
      'SELECT COUNT(*) FROM '||t.owner || '.' || t.table_name||
      ' WHERE '||t.column_name||' like :1'  
       INTO match_count 
      USING v_search_string;
    IF match_count > 0 THEN
      dbms_output.put_line( t.owner || '.' || t.table_name ||' '||t.column_name||' '||match_count );
    END IF;
  END LOOP;
END;

我這只查出  DATA_TYPE='CHAR' 請依需求改成 VARCHAR2 NUMBER....等等.

2015年3月25日 星期三

FreeNas owncloud 安裝後心得 裝好後CLIENT 用IP 可以連到主機可是用 DOMAIN NAME 又不行. .

裝好後CLIENT 用IP 可以連到主機可是用 DOMAIN NAME 又不行. 就是需要需在 config.php 中設定 trusted domain .
用SSH 連上FreeNas
>jls
JID  IP Address      Hostname                      Path
  6  -               owncloud_1                /mnt/ztank/jails/owncloud_1
進入JID 為6 的 jails
>jexec 6 /bin/tcsh 

vi /usr/pbi/owncloud-amd64/www/owncloud/config/cofnig.php
  'trusted_domains' =>
  array (
    0 => '192.168.11.4',
    0 => 'cloud.xxx.tw',
  ),



SSL renew
用SSH 連上FreeNas
>jls
JID  IP Address      Hostname                      Path
  6  -               owncloud_1                /mnt/ztank/jails/owncloud_1
進入JID 為6 的 jails
>jexec 6 /bin/tcsh 
>cd /usr/pbi/owncloud-amd64/etc/apache24/
>openssl req -new -x509 -days 3650 -nodes -out owncloud.crt -keyout owncloud.key
#請回答FQDN 相關MSG.
>vi /usr/pbi/owncloud-amd64/etc/apache22/extra/httpd-ssl.conf
找到
SSLCertificateFile "/usr/pbi/owncloud-amd64/etc/apache24/server.crt
SSLCertificateKeyFile "/usr/pbi/owncloud-amd64/etc/apache24/server.key
換成
SSLCertificateFile "/usr/pbi/owncloud-amd64/etc/apache24/owncloud.crt
SSLCertificateKeyFile "/usr/pbi/owncloud-amd64/etc/apache24/owncloud.key
重啟 apache
/usr/local/etc/rc.d/apache22 restart


2015年3月18日 星期三

VMWare Windows7 NIC did not work

1.關閉guest os 
2.編輯 guest os 的 .vmx 檔
3.在最下面加入一行

ethernet0.virtualDev = "e1000"
OK

2015年3月17日 星期二

在VMWare ESXi 5.x 上安裝FTP SERVER

請先開啟 vmware esxi server 的SSH.功能.
我是用vcenter client 去看主機的 configuration-> software\security profile-> service ( properites..)->
SSH -> option ->  start automatically if... OK


請使用有 SSH 功能的 telnet 軟體, 我是用putty
登入後. 先下載ProFTPD FTP SERVER
可用 wget 方式下載或是自行下載後 再用 vcenter server client 上傳到 vmware esxi server中
wget http://esxi-customizer.googlecode.com/files/ProFTPD-1.3.3-8-offline_bundle.zip

再執行以下命令(紅字部份請改成你自己的路徑)
esxcli software vib install --no-sig-check -d /vmfs/volumes/yourpath/ftp/ProFTPD-1.3.3-8-offline_bundle.zip
.....
Installation Result
   Message: Operation finished successfully.
   Reboot Required: false
   VIBs Installed: VFrontDe_bootbank_ProFTPD_1.3.3-8
   VIBs Removed:
   VIBs Skipped:
等他安裝完後就完成了..


要移除ProFTPD 請用以下命令
esxcli software vib remove -n ProFTPD

這時你就可以用FTP Cient 來連進這個主機了.