UWInfo Blog
發表新文章
[Join] | [忘記密碼] | [Login]
搜尋

搜尋意見
文章分類-#Author#
[所有文章分類]
所有文章分類
  • ASP.NET (48)
  • ASP.NET2.0 (15)
  • ASP.NET4.0 (34)
  • JavaScript (49)
  • jQuery (26)
  • FireFox (4)
  • UW系統設定 (3)
  • SQL (39)
  • SQL 2008 (25)
  • mirror (4)
  • SVN (4)
  • IE (9)
  • IIS (20)
  • IIS6 (1)
  • 閒聊 (7)
  • W3C (6)
  • 作業系統 (9)
  • C# (24)
  • CSS (12)
  • FileServer (1)
  • HTML 5 (11)
  • CKEditor (3)
  • UW.dll (13)
  • Visual Studio (16)
  • Browser (8)
  • SEO (1)
  • Google Apps (3)
  • 網站輔助系統 (4)
  • DNS (5)
  • SMTP (4)
  • 網管 (11)
  • 社群API (3)
  • SSL (4)
  • App_Inventor (1)
  • URLRewrite (2)
  • 開發工具 (6)
  • JSON (1)
  • Excel2007 (1)
  • 試題 (3)
  • LINQ (1)
  • bootstrap (0)
  • Vue (3)
  • IIS7 (3)
  • foodpanda (2)
  • 編碼 (2)
  • 資安 (3)
  • Sourcetree (1)
  • MAUI (1)
  • CMD (1)
  • my sql (1)
最新回應
  • Newtonsoft.Json.JsonConvert.DeserializeObject 失敗的情況
    test...more
  • dotnet ef dbcontext scaffold
    ...more
  • [ASP.NET] 利用 aspnet_regiis 加密 web.config
    ...more
  • IIS ARR (reverse proxy) 服務安裝
    ...more
  • [錯誤訊息] 請加入 ScriptResourceMapping 命名的 jquery (區分大小寫)
    ...more
  • 用 Javascript 跨網頁讀取 cookie (Cookie cross page, path of cookie)
    ...more
  • 線上客服 - MSN
    本人信箱被盜用以致資料外洩,是否可以請貴平台予以協助刪除該信箱之使用謝謝囉...more
  • 插入文字到游標或選取處
    aaaaa...more
  • IIS 配合 AD (Active Directory) 認証, 使用 .Net 6.0
    太感謝你了~~~你救了我被windows 認證卡了好幾天QQ...more
  • PostgreSQL 的 monitor trigger
    FOR EACH ROW 可能要改為 FOR EACH STATEMENT ...more
標籤
  • export
  • debug
  • [u2]
  • iis7 的設定匯
  • Nanoha
  • visual stu
  • !211211212
  • post
  • TPBase
  • CS
  • -9829 UNIO
  • db
  • @@tbkLE
  • Kil3rDz98H
  • TCP2121121
  • aes
  • win ORDER
  • outerhtml
  • MaxWorkIte
  • 15
  • DB.OrderMa
  • c
  • 928
  • net
  • collate
  • MVC
  • replace
  • 184
  • shop
  • 804
  • 284
  • 736
  • 912
  • 2873
  • 140,
  • 58
  • 分段
  • 碧潭
  • FB
  • 100
  • sp_scanL1B
  • images
  • MSkvKiovYW
  • 6866
  • IIS 設定 匯出
  • 瘦身
  • sysconfig
  • IP
  • Vgi5xJ9n
  • KF4YVucL
頁數 7 / 10 上一頁 下一頁
搜尋 end 結果:
Send Mail by godaddy
Sub SendMail_godaddy(ByVal Subject As String, ByVal Body As String, ByVal FromMail As String, ByVal ToMail As String)
        Dim objMail As New System.Web.Mail.MailMessage()

        objMail.From = FromMail
        objMail.To = ToMail
        objMail.Subject = Subject
        objMail.BodyFormat = Mail.MailFormat.Html
        objMail.Priority = Mail.MailPriority.High
        objMail.Body = Body

        System.Web.Mail.SmtpMail.SmtpServer = UW.Mail.SMTP_SERVER_NAME
        System.Web.Mail.SmtpMail.Send(objMail)
    End Sub
More...
Reiko, 2014/1/17 下午 02:50:53
Send Mail By gmail SMTP
Sub SendMail_gmail(ByVal Subject As String, ByVal Body As String, ByVal FromMail As String, ByVal ToMail As String)
        Dim msg As New System.Net.Mail.MailMessage

        Dim client As New System.Net.Mail.SmtpClient
        Try

            msg.Subject = Subject
            msg.Body = Body
            msg.From = New System.Net.Mail.MailAddress(FromMail)
            msg.To.Add(ToMail)
            msg.IsBodyHtml = True

            client.Host = "smtp.gmail.com"
            Dim basicauthenticationinfo As System.Net.NetworkCredential = New System.Net.NetworkCredential("username@gmail.com", "password")
            client.Port = Int32.Parse("587")
            client.EnableSsl = True
            client.UseDefaultCredentials = False
            client.Credentials = basicauthenticationinfo
            client.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
            client.Send(msg)

        Catch ex As Exception
            UW.WU.DebugWriteLine(ex.ToString, True, True)
        End Try

    End Sub
More...
Reiko, 2014/1/17 下午 02:48:37
[程式片段][後台]VB懶惰版快取
        
'更新
        If UW.WU.IsNonEmptyFromQueryStringOrForm("Refresh") Then
            System.Web.HttpContext.Current.Cache.Remove(CacheName)
        End If
        '快取部分
        If obj Is Nothing Then
            Dim SQL As String = ""
            SQL = "select * from Product with (nolock)"
            obj = UW.SQL.DTFromSQL(SQL)

            Dim AC As New AggregateCacheDependency

            Dim DepArray() As CacheDependency = { _
                 New SqlCacheDependency(UW.SQL.sqlCacheDependencyName, "Product"), _
                 New SqlCacheDependency(UW.SQL.sqlCacheDependencyName, "Product_Category") _
            }

            AC.Add(DepArray)
            Dim FD As New CacheDependency(UW.Template.TemplateRoot & "2013UI\Product\DirectBuyAllProduct.html")
            AC.Add(FD)

            System.Web.HttpContext.Current.Cache.Insert(CacheName, obj, AC)

        End If
More...
Doug, 2014/1/15 下午 02:12:27
IndexOf 效能問題
一直覺得 UW.Template 應該還有改善的空間,因為網站大量使用這個物件
只要有一些些效能調教,對於整體效能應該有很大的幫助

昨天發現切版的程式 UW.Template => GetTemplateFromString
在使用 IndexOf 去尋找 <!--Key S--> 及 <!--Key E--> 時,
<!--Key E--> 可能有一些問題,因為他是從第0個位置開始找
而實際上他應該是從 <!--Key S--> 後面開始找比較對
所以後者的 IndexOf 要加個 StartIndex 參數值比較對


    StartP = StartP + StartKey.Length
    Dim EndP As String = Source.IndexOf(EndKey, StringComparison.OrdinalIgnoreCase)
    ' 應該修改為以下寫法 =>
    StartP = StartP + StartKey.Length
    Dim EndP As String = Source.IndexOf(EndKey, StartP, StringComparison.OrdinalIgnoreCase)    


另外 我也針對 StringComparison 做一些測試 
然後以一個 20KB 的 html 去抓出 <!--Content E--> 的位置
測試結果如下 (StartP 是 <!--Content S--> 後的起始位置)


0.0005085 No StartP
0.0002082 with StartP
0.0000157 StringComparison.Ordinal with StartP
0.0002768 StringComparison.OrdinalIgnoreCase, No StartP
0.0001105 StringComparison.OrdinalIgnoreCase with StartP
0.0002116 StringComparison.CurrentCulture with StartP
0.0002085 StringComparison.CurrentCultureIgnoreCase with StartP


結論: 
1. IndexOf 預設是以 StringComparison.CurrentCulture 方式尋找字串
2. 對於大塊字串,請盡量用 StartP 去找結束標籤位置,這樣速度會快很多,因為少爬了一段文字,此範例是差了2.5倍
3. 對於大塊字串,除非大小寫都要找,不然盡量用 StringComparison.Ordinal 來尋找字串,速度差了7~8倍

微軟對於.NET字串處理 有一篇建議文章,請大家拜讀一下
http://msdn.microsoft.com/zh-tw/library/vstudio/dd465121(v=vs.100).aspx
More...
darren, 2014/1/14 下午 03:18:14
[程式片段][前台]VB預設
    
    Inherits Master
    Protected Sub Page_PreLoad(sender As Object, e As EventArgs) Handles Me.PreLoad
    End Sub

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        HandleAction()
    End Sub

    Sub HandleAction()
        If UW.WU.IsNonEmptyFromQueryStringOrForm("Action") Then
            Dim Action As String = UW.WU.GetValueFromQueryStringOrForm("Action")
            Select Case Action
            End Select
        End If
    End Sub

    Protected Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
        LoadPageContext()
    End Sub

    Sub LoadPageContext()

    End Sub

    Sub JSONWriteToClient(ByVal TrueorFalse As Boolean, Optional ByVal msg As String = "", Optional ByVal Title As String = "", Optional ByVal Content As String = "", Optional ByVal Content2 As String = "", Optional ByVal Content3 As String = "")
        Dim TF As String = Now.ToString("yyyyMMddHHmmss")
        Dim oJ As UW.JSON
        oJ = New UW.JSON(TrueorFalse, msg)
        oJ.add("Title", Title)
        oJ.add("Content", Content)
        oJ.add("Content2", Content2)
        oJ.add("Content3", Content3)
        oJ.add("TF", TF)
        oJ.WriteToClient()
        Response.End()
    End Sub
More...
Doug, 2014/1/6 下午 12:25:22
[程式片段][後台]VB預設

    Protected Sub Page_PreLoad(sender As Object, e As EventArgs) Handles Me.PreLoad
        SHOPUNT.GN.WSC.CheckLogin()                                     '檢查是否有登入、否則導回Login
        SHOPUNT.GN.WSC.CheckRightOrStop(SHOPUNT.EN.AuthCode.廣告管理)   '檢查是否有廣告編輯的權限
    End Sub

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        HandleAction()
    End Sub

    Sub HandleAction()
        If UW.WU.IsNonEmptyFromQueryStringOrForm("Action") Then
            Dim Action As String = UW.WU.GetValueFromQueryStringOrForm("Action")
            Select Case Action
            End Select
        End If
    End Sub

    Protected Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
        'Me.Master.strTitle = "目錄管理"
        'Me.Master.IsListItemScript = True
        LoadPageContext()
    End Sub

    Sub LoadPageContext()

    End Sub
More...
Doug, 2014/1/6 上午 11:40:25
資料庫物件方法,GetDataRowAndReturnSelfOrNothing() 使用注意
康是美出貨印單犯下的錯誤,這邊寫給未來新進同仁注意,出貨印單時發生訂單明細品項箱數與總數量不相符的問題,
測試之後發現是記錄原始訂單上傳log table [OrderFromCosmed Log] ,在撈出該筆訂單品項資料時,資料庫物件
下select條件時發生失誤,以下是程式碼:有問題的程式碼我以#號標記
               
For I As Int32 = 1 To DT.Rows.Count
                 If order_num_right = DT.Rows(I - 1)("Pid") Then
                     Pid_No = I - 1
                 End If
                 #OFCL.Pid = DT.Rows(I - 1)("Pid")
                 #OFCL.GetDataRowAndReturnSelfOrNothing()
                Dim NewT As String = oT.Result
                NewT = NewT.Replace("#Y#", StartY + (I - 1) * LH)
                NewT = NewT.Replace("#序號#", I.ToString)
                NewT = NewT.Replace("#品號#", OFCL.Pid)
                NewT = NewT.Replace("#品名#", OFCL.Product_Name)
                NewT = NewT.Replace("#包裝#", OFCL.Package)
                NewT = NewT.Replace("#單位#", OFCL.UNIT)
                NewT = NewT.Replace("#數量#", OFCL.Qty)
                NewT = NewT.Replace("#箱數#", OFCL.BOX)
                NewT = NewT.Replace("#總數量#", OFCL.Total)
                NewT = NewT.Replace("#未稅價#", OFCL.Price)
                NewT = NewT.Replace("#總金額#", OFCL.Sum)
                Res &= NewT
            Next

說明:已上程式是在撈出訂單品項資料時要對康是美印單用.txt sample檔裡面的字串作取代最後再列印,發生問題的程式碼,
主要是撈出該筆訂單品項時,使用資料庫物件的方法GetDataRowAndReturnSelfOrNothing()時,只下訂單品項id而沒有下
該筆訂單編號,導致撈出來的資料是其他訂單的同品項資料,進而導致數量箱數不符合的狀況發生!!
More...
jimmy, 2014/1/3 下午 08:51:38
onkeypress 和 keyCode 在 Firefox 的問題
在 firefox 抓不到 window.event,所以要用以下的 function 來處理 keyCode:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title> new document </title>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <script language="javascript">
  function myKeyPress(evt){
    evt = (evt) ? evt : ((window.event) ? window.event : "") //兼容IE和Firefox获得keyBoardEvent对象
    var key = evt.keyCode?evt.keyCode:evt.which; //兼容IE和Firefox获得keyBoardEvent对象的键值
    if(evt.ctrlKey && (key == 13 || key == 10)){
      alert("send");//同时按下了Ctrl和回车键
      
    }
  }
</script>
</head>


<body onkeypress="myKeyPress(event)"> 
</body>
</html>



參考: http://www.felix021.com/blog/read.php?1171
More...
Bike, 2013/12/6 下午 02:13:09
使用 Clonezilla 來複製硬碟
  1. 下載 再生龍單機板 zip 檔.
  2. 如果您的 USB 裝置已經存在一個 FAT 格式的分割區(至少 200 MB),請跳到步驟(3).
    否則,請 在您的 USB裝置上產生一個 FAT16或 FAT32 格式的分割區(至少 200 MB)
  3. 解壓縮 zip 並把其中所有的檔案放置您的 FAT 分割去中,並保持目錄架構. 例如:"COPYING" 檔案應該在 USB 裝置的根目錄下(如:G:\COPYING).
  4. 瀏覽您的 USB 裝置,在 utils\win32\ 目錄下(如:G:\utils\win32\) 並以『管理者身分執行』 makeboot.bat 
    警告! makeboot.bat 必須在您的 USB 裝置上執行.
  5. 依畫面指示進行.
    (PS: 上述是由下面資訊修改而來 : http://www.pendrivelinux.com/2007/01/02/all-in-one-usb-dsl. 感謝 PDLA : http://pendrivelinux.com)
參考: http://clonezilla.nchc.org.tw/clonezilla-live/liveusb.php
More...
Bike, 2013/11/25 下午 06:16:01
善用 Request.Cookies.Set After Respnse.Cookies.Add
ASP.NET程式開發時,有時候會寫資料到cookies
這時我們會用 Response.Cookies.Add 寫入
但是大家都會忽略到一種情況,如果後面程式也會使用到該cookies時
Request.Cookies 會抓不到剛設定的cookies
這時就要 Request.Cookies.Set 來設定 Request 值

錯誤示範:
Page_Load --> Response.Cookies.Add a Cookie named "test"
Page_PreRender --> Request.Cookies("test") --> Nothing 

正確示範(同時寫兩行):
Page_Load --> Response.Cookies.Add a Cookie named "test"
              Request.Cookies.Set a Cookie named "test" 
Page_PreRender --> Request.Cookies("test") --> Got it!

 
More...
darren, 2013/11/4 下午 06:37:03
|< 12345678910 >|
頁數 7 / 10 上一頁 下一頁
~ Uwinfo ~