2010年12月8日 星期三

如何移除 XP 中的服務

sc delete [service name]

有些軟體在反安裝之後,
不會把安裝的服務移除,
依然留在服務列表中,
要整個完全移除,該怎麼做呢 ?

命令列下使用
sc delete [service name]

以下為實際執行成果

Microsoft Windows XP [版本 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>cd \

C:\>sc delete OracleOraHome81ClientCache
[SC] DeleteService SUCCESS

C:\>

依樣畫葫蘆,也可以用命令列啟動 OR 關閉服務

Vb.Net 寫事件檢視器寫入問題

Vista,Windows7+UAC
WINServer2003 2008 寫事件檢視器寫入問題

Code:

Dim myLog As New Diagnostics.EventLog
Dim dtNow As Date = Date.Now
Dim EventStr As String = "DATE:" & dtNow.ToString & "." & Format(dtNow, "ffff")

' Write an information to the event log.

myLog.Source = "XXXX"
myLog.Log = "Application"
myLog.WriteEntry(EventStr, ErrorType)myLog.Dispose()

是想要在系統事件器的應用程式(Application)中
加一個來源(Source)為XXXX的事件
XP上應該都OK啦,
但是VISTA,WINDOWS7,WINS2003,WINS2008管的比較嚴,就可能會有問題,
如果出現錯誤[System.Security.SecurityException: 不允許要求的登錄權限。],
就必要要做以下的調整

在 [登錄編輯程式(Regedit)] 中建立事件來源(XXX)下
應用程式(Application)事件日誌(EvenlLog)。
1.執行Regedit
2.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application增加機碼XXX就這樣嘍

MS寫的很複雜,原文如下 http://support.microsoft.com/kb/329291

Oracle Sql Developer 設定為英文界面

Oracle Sql Developer V2.1 ~ V3.0.2

沒有語言選項要如何設定為英文界面?

打開 \sqldeveloper\sqldeveloper\bin\sqldeveloper.conf

用記事本加兩行即可

AddVMOption -Duser.language=en
AddVMOption -Duser.country=US


Vb.Net 中英混合 Substring

'Imports System
'Imports System.Text

Public Function Substring_ByByte_Big5(ByVal inString As String, ByVal StartByte As Integer, Optional ByVal Length As Integer = 0) As String

'BIG5:中文2碼英文1碼
Dim byte_Big5() As Byte = Encoding.GetEncoding("BIG5").GetBytes(inString)
Dim intTotLength As Integer = byte_Big5.Length
Dim intRtnLength As Integer
Dim strRtn As String = ""

If Length = 0 Then
intRtnLength = intTotLength - StartByte
Else
If Length + StartByte > intTotLength Then
intRtnLength = intTotLength - StartByte
Else
intRtnLength = Length
End If
End If

Dim byteRtn(intRtnLength - 1) As Byte
Dim intPOS As Integer

For intPOS = 0 To intRtnLength - 1
byteRtn(intPOS) = byte_Big5(StartByte + intPOS)
Next

strRtn = Encoding.GetEncoding("BIG5").GetString(byteRtn)

Return strRtn

End Function

'執行結果
'strS = "中英混合CHINESE-ENGLISH-MIX"

'Substring_ByByte_Big5(strS, 0) = 中英混合CHINESE-ENGLISH-MIX
'Substring_ByByte_Big5(strS, 1) = 五^混合CHINESE-ENGLISH-MIX
'Substring_ByByte_Big5(strS, 2) = 英混合CHINESE-ENGLISH-MIX
'Substring_ByByte_Big5(strS, 3) = ^混合CHINESE-ENGLISH-MIX

'Substring_ByByte_Big5(strS, 0, 12) = 中英混合CHIN
'Substring_ByByte_Big5(strS, 1, 12) = 五^混合CHINE
'Substring_ByByte_Big5(strS, 2, 12) = 英混合CHINES
'Substring_ByByte_Big5(strS, 3, 12) = ^混合CHINESE