2010年5月19日 星期三
Oracle information
最新資訊下載…可以去看看
http://edelivery.oracle.com/EPD/GetUserInfo/get_form?caller=WelcomePage
2009年12月20日 星期日
IsolatedStorage
組件:mscorlib.dll
IsolatedStorage類別:所有隔離儲存區的基底類別(抽象類別)
IsolatedStorageFile類別:表示含有檔案和目錄隔離儲存區
IsolatedStorageScope enumeration:列舉IsolatedStorage所支援的隔離儲存區範圍層次
IsolatedStorageFileStream類別:公開隔離區(Isolated Storage)中的檔案
- Application 範圍限定於應用程式的隔離儲存區。
- Assembly 範圍限定於組件 (Assembly) 識別 (Identity) 的隔離儲存區。
- Domain 範圍限定於應用程式定義域識別的隔離儲存區。
- Machine 範圍限定於電腦的隔離儲存區。
- None 沒有隔離儲存區的使用。
- Roaming 隔離儲存區可以放置在可能漫遊的檔案系統某一處 (如果漫遊使用者資料在基礎作業系統中啟用)。
- User 由使用者識別限定範圍的隔離儲存區。
Example 1
IsolatedStorageFile isoFile =
IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
IsolatedStorageScope.Assembly |
IsolatedStorageScope.Domain,
null,
null);
IsolatedStorageFileStream isoStream =
new IsolatedStorageFileStream(this.userName,
FileMode.Open,
FileAccess.Read,
FileShare.Read);
Example 2
IsolatedStorageFile isoFile;
private void Form1_Load(object sender, EventArgs e)
{
isoFile = IsolatedStorageFile.GetMachineStoreForDomain();
}
private void button1_Click(object sender, EventArgs e)
{
String fileName = textBox1.Text;
try{
using (FileStream fs= new IsolatedStorageFileStream(fileName,
FileMode.Open, FileAccess.Read, isoFile))
{
StreamReader sr = new
StreamReader(fs,Encoding.GetEncoding("big5"));
textBox2.Text=sr.ReadToEnd();
sr.Close();
}
}catch(Exception ex){
MessageBox.Show(ex.Message);
}
}
MarshalByRefobject
啟用在支援Remoting Application中跨越Application domain boundaries中的存取。
命名空間:System
組件:mscorlib.dll
有兩種型態的遠端物件
- Marshal-by-value objects:藉由「值」,這些物件被複製和傳遞,傳出應用程式定義域
- Marshal-by-reference objects:藉由使用「Proxy」,這些物件被存取外部應用程式定義域。Client需要「Proxy」來使用這些物件,去存取這些遠端的物件。
當跨越應用程式定義域界限來使用型別時,型別必須繼承自 MarshalByRefObject,並且不可以複製物件的狀態,因為物件的成員無法在建立成員的所在應用程式定義域外部使用。
using System;
using System.Runtime.Remoting;
using System.Security.Permissions;
public class SetObjectUriForMarshalTest {
class TestClass : MarshalByRefObject {
}
[SecurityPermission(SecurityAction.LinkDemand)]
public static void Main() {
TestClass obj = new TestClass();
RemotingServices.SetObjectUriForMarshal(obj, "testUri");
RemotingServices.Marshal(obj);
Console.WriteLine(RemotingServices.GetObjectUri(obj));
}
}
2009年11月22日 星期日
2009年11月19日 星期四
限制條件
1、 PROCEDURE需包在PACKAGE中才能執行
2、 必須以TABLE的型態回傳值,使用型態ReturnTbl
步驟一、連線ORACLE(SQL SERVER建立)
1、建立連線伺服器
sp_addlinkedserver @server='TEST80' ,@srvproduct='Oracle',@datasrc = 'TEST80.WORLD',@provider='MSDAORA',@provstr='MSDAORA'
2、到主控台根目錄-->連線伺服器-->TEST80
3、按右鍵選內容
4、選取「安全性」頁籤,勾選「使用下列安全性條件進行連線」,輸入測試帳號/密碼步驟二、建立PACKAGE(ORACLE建立)
--BODY
CREATE OR REPLACE PACKAGE BODY CRM.WrapPack
AS
PROCEDURE WrapPackSP( ReturnVal OUT ReturnTbl)
IS
Begin
ReturnVal( 1 ) := 0;
End WrapPackSP;
End WrapPack;
/
--SPEC
CREATE OR REPLACE PACKAGE CRM.WrapPack AS
TYPE ReturnTbl IS TABLE OF NUMBER
INDEX BY BINARY_INTEGER;
PROCEDURE WrapPackSP
(
ReturnVal OUT ReturnTbl
);
END WrapPack;
/
步驟三、執行PACKAGE(SQL SERVER執行)
SELECT * FROM OPENQUERY( TEST80 ,'{Call CRM.WrapPack.WrapPackSP({resultset 1 , ReturnVal} )}')
2009年10月26日 星期一
禁止用戶可進入控制台 及 完全或局部禁制控制台某些功能
參考原文:http://www.wells.hk/ws_toolsdetail.php?tools_id=1103102901
主題: 禁止用戶可進入控制台 及 完全或局部禁制控制台某些功能
主題內容:
為避免用戶亂動「控制台」內的敏感設定,可禁止用戶使用控制台的功能,方法:啟動Regedit,到路徑HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer,加入一個名叫「NoControlPanel」DWORD值,並將它設定為「1」。
若要進一步禁制控制台某些功能,可依下列方法達到目的:啟動Regedit,到路徑HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Uninstall,加入以下的DWORD值,將其設定為「1」來禁止使用,「0」為容許使用。
NoAdd RemovePrograms – 禁止新增或移除程式
NoRemovePage – 禁止更改或移除程式
NoAddPage – 禁止新增程式
NoWindowsSetupPage – 停用Windows Components Wizard
NoAddFromCDorFloppy – 隱藏「從光碟或磁片新增程式」選項
NoAddFromInternet – 隱藏「從微軟新增程式」選項
NoAddFromNetwork – 隱藏「從網路新增程式」選項
NoServices – 直接啟動Windows元件精靈
NoSupportInfo – 不顯示支援資訊
檔案系統
1、檔案系統的類別
(1)FileSystemInfo類別
(2)FileInfo類別
(3)DirectoryInfo類別
2、DriveInfo類別
(1)Drive Type列舉常數
3、FileSystemWatcher類別
說明:將介紹檔案系統,包含如何透過.NET的類別取得目錄、檔案以及系統磁碟清單。
- 檔案系統的類別
- 存取磁碟資訊
- 監控檔案目錄
最近試著想寫寫看我的電腦,這部份是為了活用之前學習的檔案系統,順手就記了下來
//宣告DriveInfo類別物件,使用getDrives方法取得
//系統所有邏輯磁碟機的DriveInfo類別型態
//直接加入tscbo_DriveList.Item裡
DriveInfo[] drivesInfo = DriveInfo.GetDrives();
tscbo_DriveList.Items.Add("我的電腦");
tscbo_DriveList.Items.AddRange(drivesInfo);
//foreach寫法
if (tscbo_DriveList.SelectedItem.ToString() == "我的電腦")
{
DriveInfo[] dri = DriveInfo.GetDrives();
lst_Detail.Clear();
foreach (DriveInfo tempdri in dri)
{
lst_Detail.Items.Add(tempdri.Name);
}
}
//宣告DirectoryInfo類別物件並指定路徑參數
DirectoryInfo dir = new DirectoryInfo(tscbo_DriveList.SelectedItem.ToString());
if (dir.Exists)
{
lst_Detail.Clear();
//利用GetDirectories()方法列出子路徑
foreach (DirectoryInfo tempDir in dir.GetDirectories())
{
lst_Detail.Items.Add(tempDir.FullName.Substring(
tscbo_DriveList.SelectedItem.ToString().Length,
tempDir.FullName.Length - tscbo_DriveList.SelectedItem.ToString().Length));
}
//利用GetFiles()方法列出檔名
foreach (FileInfo tempDir in dir.GetFiles())
{
lst_Detail.Items.Add(tempDir.FullName.Substring(
tscbo_DriveList.SelectedItem.ToString().Length,
tempDir.FullName.Length - tscbo_DriveList.SelectedItem.ToString().Length));
}
}
//取得特殊資料夾的所在目錄
string DesktopDir = System.Environment.GetFolderPath(
Environment.SpecialFolder.DesktopDirectory);
DirectoryInfo dir = new DirectoryInfo(DesktopDir);
//AllUsersApplicationData 取得路徑名稱,該路徑指向 \Documents and Setting\All //Users\ApplicationData 目錄中的應用程式資料。
//CurrentUserApplicationData 取得路徑名稱,該路徑指向 [CurrentApplicationData] 目錄。
//Desktop 取得路徑名稱,該路徑指向桌面目錄。
//MyDocuments 取得路徑名稱,該路徑指向 [MyDocuments] 目錄。
//MyMusic 取得路徑名稱,該路徑指向 [My Music] 目錄。
//MyPictures 取得路徑名稱,該路徑指向 [My Pictures] 目錄。
//ProgramFiles 取得路徑,該路徑指向 [Program Files] 目錄。
//Programs 取得路徑名稱,該路徑指向 [Programs] 目錄。
//Temp 取得路徑名稱,該路徑指向 [Temp] 目錄。