2017年7月28日 星期五

QNAP Qsync 檔案同步工具



前置作業:

NAS端安裝Qsync Central

電腦端安裝Qsync




NAS 設定方式:

NAS共用資料夾設定:

方法1. 新增資料夾並將進階設定中的“啟用共享資料夾可同步化功能”勾選

方法2.原有共用資料夾設定
           控制台 -> 共用資料夾 -> 屬性編輯內容 -> “啟用共享資料夾可同步化功能”






桌機設定方式:

安裝完Qsync後進入設定畫面


固定在家使用的裝置使用區域網路收尋方式建立,會帶出門使用以QID方式建立

開啟瀏覽及配對資料夾功能即可看到NAS上可以使用的資料夾按加號將本機端要同步的資料夾配對上去即可使用。




+









標籤: , ,

2013年3月27日 星期三

ASP 身分驗證


Function CheckID(ID)
 ID = UCase(ID)
 Dim regEx, retVal,IDChk,msg      ' 建立變量。
 Set regEx = New RegExp ' 建立正則表達式。
 regEx.Pattern = "([A-Z]{1}[12]{1}[0-9]{8}|[A-Z]{1}[ABCD]{1}[0-9]{8})" ' 設置模式。
 regEx.IgnoreCase = False ' 設置是否區分大小寫。
 retVal = regEx.Test(ID) ' 執行搜索測試。
 If retVal Then
         IDChk = True: msg = "身分證正確!!"
 Else
         msg = "身分證輸入錯誤,請再檢查!"    
 End If
 CheckID = IDChK
END FUNCTION

2013年3月14日 星期四

T-SQL


ROW_NUMBER函数允许以上升,连续的顺序给每一行数据一个序号,注意ROW_NUMBER()后面一定要跟着over子句。

ROW_NUMBER() over(order by LastName) as RowNum

來源:http://www.cnblogs.com/tylerdonet/archive/2011/07/08/2101384.html


取得 SQL Server 資料庫正在執行的 T-SQL 指令與詳細資訊

標籤:

2012年12月21日 星期五

NET USE


 Protected Sub ropen()
        Dim processInfo As New System.Diagnostics.ProcessStartInfo()
        processInfo.FileName = "C:\WINDOWS\system32\net"
        processInfo.Arguments = "use \\xxx.xxx.x.xx /user:username key"
        System.Diagnostics.Process.Start(processInfo)
    End Sub


    Protected Sub rclose()
        Dim processInfo As New System.Diagnostics.ProcessStartInfo()
        ProcessInfo.FileName = "C:\WINDOWS\system32\net"
        processInfo.Arguments = "use \\1xxx.xxx.x.xx /DELETE"
        System.Diagnostics.Process.Start(processInfo)
    End Sub



*net user 查看使用者清單

  *net user 使用者名 密碼 /add 添加使用者

  *net user 使用者名 密碼 更改使用者密碼

  *net localgroup administrators 使用者名 /add 添加使用者到管理組

  *net user 使用者名 /delete 刪除使用者

  *net user 使用者名 查看使用者的基本情況

  *net user 使用者名 /active:no 禁用該使用者

  *net user 使用者名 /active:yes 啟用該使用者

  *net share 查看電腦IPC$共用資源

  *net share 共用名稱 查看該共用的情況

  *net share 共用名稱=路徑 設置共用。例如 net share c$=c:

  *net share 共用名稱 /delete 刪除IPC$共用

  *net use 查看IPC$連接情況

  *net use //ip/ipc$Content$nbsp;"密碼" /user:"使用者名" ipc$連接

  *net time //ip 查看遠端電腦上的時間

  *copy 路徑:/檔案名 //ip/共用名稱 複製檔到已經ipc$連接的電腦上

  *net view ip 查看電腦上的共用資源

  *ftp 伺服器位址 進入FTP伺服器

  *at 查看自己電腦上的計畫作業

  *at //ip 查看遠端電腦上的計畫作業

  *at //ip 時間 命令(注意加盤符) 在遠端電腦上加一個作業

  *at //ip 計畫作業ID /delete 刪除遠端電腦上的一個計畫作業

  *at //ip all /delete 刪除遠端電腦上的全部計畫作業

標籤:

2012年12月20日 星期四

上傳檔案


轉貼至ASP.NET 如何上傳檔案至遠端機器上

RemoteCopy.aspx.vb
Imports System.Web.Security
Imports System.Security.Principal
Imports System.Runtime.InteropServices
Partial Class RemoteCopy
    Inherits System.Web.UI.Page
    Dim LOGON32_LOGON_INTERACTIVE As Integer = 2
    Dim LOGON32_PROVIDER_DEFAULT As Integer = 0
    Dim impersonationContext As WindowsImpersonationContext
    Declare Function LogonUserA Lib "advapi32.dll" (ByVal lpszUsername As String, _
                        ByVal lpszDomain As String, _
                        ByVal lpszPassword As String, _
                        ByVal dwLogonType As Integer, _
                        ByVal dwLogonProvider As Integer, _
                        ByRef phToken As IntPtr) As Integer
    Declare Auto Function DuplicateToken Lib "advapi32.dll" ( _
                        ByVal ExistingTokenHandle As IntPtr, _
                        ByVal ImpersonationLevel As Integer, _
                        ByRef DuplicateTokenHandle As IntPtr) As Integer
    Declare Auto Function RevertToSelf Lib "advapi32.dll" () As Long
    Declare Auto Function CloseHandle Lib "kernel32.dll" (ByVal handle As IntPtr) As Long
    Private Function impersonateValidUser(ByVal userName As String, ByVal domain As String, ByVal password As String) As Boolean
        Dim tempWindowsIdentity As WindowsIdentity
        Dim token As IntPtr = IntPtr.Zero
        Dim tokenDuplicate As IntPtr = IntPtr.Zero
        impersonateValidUser = False
        If RevertToSelf() Then
            If LogonUserA(userName, domain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, token) <> 0 Then
                If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then
                    tempWindowsIdentity = New WindowsIdentity(tokenDuplicate)
                    impersonationContext = tempWindowsIdentity.Impersonate()
                    If Not impersonationContext Is Nothing Then
                        impersonateValidUser = True
                    End If
                End If
            End If
        End If
        If Not tokenDuplicate.Equals(IntPtr.Zero) Then
            CloseHandle(tokenDuplicate)
        End If
        If Not token.Equals(IntPtr.Zero) Then
            CloseHandle(token)
        End If
    End Function
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As SystemEventArgs) Handles Button1.Click
       If impersonateValidUser("userName", "xx.xx.xx.xx", "password") Then
            FileUpload1.SaveAs(
\\xx.xx.xx.xx\test\XX.TXT)
        End If

    End Sub
End Class

標籤:

2012年11月8日 星期四

動態產生控制項(Radiobutton)


Public Sub Radiobutton(ByVal Items As Integer)
        Dim RadioBut As New RadioButtonList
        RadioBut.ID = "RB" & Items
        RadioBut.Items.Add("選擇題")
        RadioBut.Items.Add("問答題")
        RadioBut.RepeatDirection = RepeatDirection.Horizontal
        PlaceHolder1.Controls.Add(New LiteralControl(" <td width=30%>"))
        PlaceHolder1.Controls.Add(RadioBut)
        PlaceHolder1.Controls.Add(New LiteralControl(" </td>"))
        PlaceHolder1.Controls.Add(New LiteralControl(" <tr>"))
        PlaceHolder1.Controls.Add(New LiteralControl(" </table>"))
    End Sub


動態產生控制項抓取
 RadioBut = PlaceHolder1.FindControl(Ite)

標籤:

動態產生控制項(TextBox)

Public Sub Textbox(ByVal Items As Integer)
        Dim TexBox As New TextBox
        TexBox.ID = "TB" & Items
        TexBox.Width = 450
        TexBox.Height = 15
        PlaceHolder1.Controls.Add(New LiteralControl(" <table border=1 width=100%>"))
        PlaceHolder1.Controls.Add(New LiteralControl(" <td width=10%>"))
        PlaceHolder1.Controls.Add(New LiteralControl("題目" & Items))
        PlaceHolder1.Controls.Add(New LiteralControl(" </td>"))
        PlaceHolder1.Controls.Add(New LiteralControl(" <td width=60%>"))
        PlaceHolder1.Controls.Add(TexBox)
        PlaceHolder1.Controls.Add(New LiteralControl(" </td>"))
End Sub

標籤: