JAVA錯誤訊息: unmappable character for encoding MS950

在Win7下編譯原始檔時,出現下列的錯誤:warning: unmappable character for encoding MS950
因為我是用Notepad++編輯,並且將字元集設定為utf-8,所以遇到中文字時就會產生無法匹配的情形。
因此在編譯時需要使用參數encoding來進行轉換,如下:
javac -encoding utf-8 001.java

另外我把Notepad++ 的字元集設定為ANSI,則編譯時就不會出現錯誤了

JAVA錯誤訊息:Could not find the main class

要執行已經編譯好的Class時,出現Error的訊息,class檔放在d:\Java_test
c:\  java test001

Exception in thread "main" java.lang.NoClassDefFoundError: test001
Caused by: java.lang.ClassNotFoundException: test001
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: test001.  Program will exit.

因為程式的內容只有把變數的值給秀出來,所以非常的簡單。
原因是沒有設定環境變數CLASSPATH,在Windows的CMD直接下:
c:\ set CLASSPATH=d:\Java_test

或者設定Windows7的環境變數:開始 --> 電腦按右鍵 --> 內容 --> 進階系統設定 --> 環境變數
新增或編輯CLASSPATH

或者在執行java時指定class的位置,如:
c:\ java -classpath d:\java_test Test001

Win7登入前出現自訂內容的視窗

公司的電腦在按下 CTRL + ALT + DEL 之後,會先出現一個電腦使用注意事項的視窗,按下確定之後才進行登入,
好奇之下,找一下如何才能有這樣的功能,原來是修改登錄檔即可。

啟動 [登錄編輯程式]。
找出方式樹狀子結構,然後再移至下列機碼:
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
新增或修改下列值:
   Name                 Data Type   Value
   -----------------------------------------------
   LegalNoticeCaption   REG_SZ      Dialog Caption
   LegalNoticeText      REG_SZ      Dialog Message
                        
其中LegalNoticeCaption是抬頭;LegalNoticeText是內文。

但是我們公司設定在下列路徑,機碼則是一樣:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System

測試用 PSTools 來移除Win7被Hang住的遠端桌面連線

測試用 PSTools 來移除Win7被Hang住的遠端桌面連線

下載:http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

我把它解壓到c:\pstools

開啟本機的CMD,連線到遠端主機的CMD:
c:\pstools> psexec \\192.168.0.105 -u USER_NAME -p PASSWORD cmd.exe

查詢遠端主機目前的登入狀況,並且記下session id 或是 session name
c:\ query session
(WinXP可用指令qwinsta來查詢)

如果要刪除ID 2的Sessin則輸入:
c:\ logoff 2

如果連線遠端時出現Make sure that the default admin$ share is enabled,
表示遠端沒有開啟admin$共用,可依下列方法:

1、開啟Win7的登錄檔,依下列路徑找LocalAccountTokenFilterPolicy,如找不到則直接新增
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
將LocalAccountTokenFilterPolicy改為1( 0:禁用,1:啟用 ),新增的話類別選擇DWORD

2、可執行下列的命令來手動啟用:net share admin$ /umlimited
   要手動移除則以下列的命令:net share admin$ /del
   輸入 net shrae,可以查詢目前系統所以開啟的共用

HP Data Protector License問題

license的檔名為:lic.dat,UNIX位於 /etc/opt/omni/server/cell 內,
當lic.dat不見或內容有問題時,操作DP會出現 No Cell Manager Licenses Available  的錯誤。
此時可以直接編輯 lic.dat ,把 key直接輸入檔案內,或直接刪掉 lic.dat,
再到GUI中新增 key:GUI --> Clients --> Data Protector Cell 按右鍵 --> Add licenses

key的格式大致如下,一次輸入一行:
28WV ABAB ABAB ABAB ABAB ABAB ABAB ABAB "Product AAAAAA"
6PUV ABAB ABAB ABAB ABAB ABAB ABAB ABAB"Product=AAAAAA"

可用 omnicc -query 來查詢授權的狀態



ORA-04031: "unable to allocate n bytes of shared memory ("shared pool" …

 今天AP人員告訴我在執行一段程式時發生了ORA-04031的錯誤:
ORA-04031: "unable to allocate 6488 bytes of shared memory ("shared pool" …

為了讓程式可以正常執行,只好更改shared pool的大小。
但是直接加大shared pool會產生下列的錯誤
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-04033: Insufficient memory to grow pool

資料庫的版本是9iR2,可能動態更改shared pool的大小,
但是因為整個SGA大小是固定的,只好先縮小DB Cache的大小才能再加大shared pool

下面可以查詢目前設定的大小
select * from v$parameter where name like 'share_pool_size' ;
select * from v$parameter where name like 'db_cache_size' ;
select * from v$parameter where name like 'sga_max_size' ;

原本DB Cache 為4500MB,先縮小它
alter system set db_cache_size =4000M;

原本的shard pool為800M,現在暫時加大它
ALTER SYSTEM SET shared_pool_size =1300M;

因為我沒有指定寫入spfile,所以下次重開機後,就會恢復原設定值。

Excel用countif 函數找出特定值在資料範圍內出現的次數

想知道某個特定值在資料範圍內出現的次數,可以用countif
如下圖範例,有許多不同時間到訪過的地點的資料集合,
現在想要統計台南、台北、高雄三個地方各去過幾次,
利用countif(資料範圍,比對值)就可以知道了。
除了可以比對字串之外,也可以利用邏輯運算,
如:countif(A1:A200,"<60")

Oracle ERP 如何在report中使用fnd_global.user_id

今天在開發Oracle ERP的Report時,想以下列的PL/SQL來找出登入的員工姓名,
但是卻發現Report執行出來的結果都是空白。

begin
  select replace(papf.full_name,',',null)
    into x_ls_user
    from fnd_user              fu
        ,per_all_people_f      papf
   where fu.employee_id = papf.person_id
     and fu.user_id = fnd_global.user_id;  
exception
  when others then
    x_ls_user := null;
end;

從Goole找到原因,原來是必需先在Report Trigger的BeforeReport和AfterReport中加入下列程式:
begin
  SRW.USER_EXIT('FND SRWINIT');
exception when srw.user_exit_failure then
  srw.message(3001,'Error in SRWINIT');
  raise;
end;
  return (TRUE);
  
如果要使用fnd_profile.value,也是如此。