2011年6月30日 星期四

ASP.Net 設定轉址

1.可在Page_Load事件加入:
response.redirect (~/xxx.aspx")
2.可用文字檔新增一個xxx.asp的檔案,內容為:
<% response.redirect ("http://www.google.com.tw") %>

[轉貼] .Net 如何知道遠端電腦的剩餘磁碟空間

來源:http://www.blueshop.com.tw/board/show.asp?subcde=BRD200607311444336E3&fumcde=FUM20050124191756KKC&odr=cdt&odrtyp=0



Imports System.Runtime.InteropServices

    <DllImport("Kernel32")> _
    Public Shared Function GetDiskFreeSpaceEx(ByVal lpDirectoryName As String, ByRef lpFreeBytesAvailable As UInt64, ByRef lpTotalNumberOfBytes As UInt64, ByRef lpTotalNumberOfFreeBytes As UInt64) As <MarshalAs(UnmanagedType.Bool)> Boolean
    End Function

    Private Function GetFreeDiskSpace(ByVal driveLetter As String) As UInt64

        Dim freespace As UInt64
        If GetDiskFreeSpaceEx(driveLetter, Nothing, Nothing, freespace) Then
            Return freespace
        Else
            Return New UInt64
        End If

    End Function

Dim dirName As String = "C:\"
        MessageBox.Show(String.Format("{0} 目前尚有 {1} 個位元組的可用空間", dirName, GetFreeDiskSpace(dirName)))
----------------------------------------------------------------------------
 Dim cdrive As System.IO.DriveInfo
    cdrive = My.Computer.FileSystem.GetDriveInfo("C:\")
    MsgBox("Total free space: " & CStr(cdrive.TotalFreeSpace))

[轉貼] VB6.0 如何知道遠端電腦的剩餘磁碟空間

來源:http://www.programmer-club.com.tw/ShowSameTitleN/vb/32456.html

Private Declare Function GetDiskFreeSpace Lib "kernel32" _
   Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, _
   lpSectorsPerCluster As Long, lpBytesPerSector As Long, _
   lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long

Public Function GetFreeHDSpace(ByVal Path As String) As Variant
Dim Status As Long
Dim dbV As Double
Dim SecPerClust As Long
Dim BytePerSec As Long, FreeClust As Long, totClust As Long
Status = GetDiskFreeSpace(Path, SecPerClust, BytePerSec, FreeClust, totClust)
dbV = SecPerClust * BytePerSec
dbV = dbV * FreeClust
GetFreeHDSpace= dbV
End Function

Private Sub Command1_Click()
MsgBox GetFreeSpace("\\x.x.x.x\c$")
End Sub

用遠端桌面連Windows XP時的關機方式

1.30秒後重開機:shutdown - r -t 30


2.30秒後關機:shutdown - s -t 30


也可以做成批次檔放在桌面上

製作可以安裝 Windows 7 / Windows Server 2008 R2 的USB隨身碟

1.在 Windows 7 或 Windows Server 2008 R2 的環境下
   用系統管理員的身份執行『命令提示字元』
2.diskpart
3.list disk:會列出該台電腦所有的實體磁碟
4.檢查結果,並紀錄隨身碟的磁碟編號
5.select disk n:n是隨身碟的磁碟編號
6.clean:清理隨身碟,不會再有任何分割區
7.create partition primary:會在隨身碟建立主分割區
8.select partition 1:選取隨身碟的唯一分割區
9.active:將所選取的分割區設為「使用中」
10.format fs=fat32 quick:將隨身碟格式化成FAT32
11.assign:將磁碟代號指定給隨身碟的分割區
12.exit:結束命令提示字元
13.將Windows 7或Windows Server 2008 R2 安裝光碟的內容全部複製到USB裡

安裝MS SQL Server 時發生[效能計數器登錄區一致性]的錯誤

我遇過幾次,有2種方式可以試試看,都不行的話,只好重裝了....

1.檢查該台電腦的地區語言選項是否與SQL SERVER 安裝版本一致

2.修改登錄編輯器
(1)執行 regedit
(2)HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
(3)進入004,檢查counter的值(就拉到最下面看最後一組數字)
(4)進入009,檢查counter的值 (同上)
(5)比較誰的數字比較大,記錄下來
(6)回到上一層的Perflib然後編輯Last Counter的值,將該數字填入(記得要選10進位)
(7)關機重開重新安裝SQL SERVER

讓TeamViewer只能接受區網內的連線遙控

General --> Incoming LAN connections --> 選擇 accept