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
標籤
  • mod ORDER
  • [u2]
  • -1140
  • link sql
  • c?!a3?e??a
  • 674
  • html
  • write
  • transactio
  • 0,
  • Ttzdu6Pf
  • timeout
  • 1
  • 856
  • 486
  • 826
  • ??21211211
  • sqlcmd
  • 1833
  • if21211211
  • -2484 UNIO
  • 422
  • .net core
  • 備註
  • [t],
  • CK
  • -1844 UNIO
  • my sql
  • 貼
  • Operation
  • big5 order
  • tim
  • C
  • ENum
  • 644
  • http 錯èª
  • gM8ynCeE
  • 1602
  • spf
  • unt
  • 138
  • message,
  • Chrome2121
  • IIS匯出
  • 上傳圖片
  • LINE
  • face,
  • ajaxupload
  • 1498
  • 774
頁數 37 / 53 上一頁 下一頁
搜尋 [u2] 結果:
SqlDependency 之 Stored Procedure
SqlDependency 的原理是對某些目標 table 設定所謂的 ChangeId
資料存在 dob.[AspNet_SqlCacheTablesForChangeNotification]
當目標 Table 有 Insert, Update, Delete 時會 Trigger 把 ChangeId + 1
而前端網站就是不斷定時詢問此 [AspNet_SqlCacheTablesForChangeNotification] 的 ChangeId


-- 新增目標 Table 加入 SqlDependency (此範例 MenuFirst是 table name)
Exec dbo.AspNet_SqlCacheRegisterTableStoredProcedure N'MenuFirst'

-- 直接變更 ChangeId (效果等同於去變更該table資料)
-- 會去將 ChangeId + 1
EXEC dbo.AspNet_SqlCacheUpdateChangeIdStoredProcedure N'MenuFirst'


AspNet_SqlCacheUpdateChangeIdStoredProcedure 通常是不需要做的
因為目標table都有設定 Trigger
但是在某些狀況下 目標table資料沒有變更 但是也希望前端cache要更新
就可以用此 SP
 
More...
darren, 2014/1/21 下午 12:25:33
[SQL] 簡體字存入資料庫之亂碼
Question :  update sql 若有簡體字. 會出現? 
Sol :   '  '   在加字串第一個的 ' (單引號)  前 加上 N  (大寫)
資料庫型態須定義為 ntext 或是 nchar , nvarchar
若定義成一般習慣前面未加 'N' 使用 Big-5 
 
More...
Vicky, 2014/1/20 上午 09:52:18
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
[程式提醒][Ajax][html] jQuery 做 HTML本文做取代時要注意 Javascript
當使用Ajax做回應的時候~
有時候會將HTML本文做取代
例如:$(e).html(回應文)、$(e).replaceWith(回應文)
但是回應文中若是包含Javascript可能會執行,但是並不會顯示在Html裡面
注意:會執行、但不一定會顯示
More...
Doug, 2014/1/10 上午 10:45:00
[程式提醒][VB.net]
當進行玩物件Update指令之後~不見得所有的資訊會跟著更新~
舉例:
ShippingInfo 在Update之後
ShippingInfo.FullAddress的內容為
Me.Post_Code & Me.County_Name & Me.City_Name & Me.Address

但是Me.County_Name & Me.City_Name的部分是用join出來的~
所以不會更新
因此地址部分會是錯誤的~

所以在執行update完之後~還是重新再new一次以保資料會是最新的~
More...
Doug, 2014/1/10 上午 10:41:04
Arithmetic overflow error converting nvarchar to data type numeric when the value is 0
Arithmetic overflow error converting nvarchar to data type numeric when the value is 0
solution : add   '  '   
More...
Vicky, 2014/1/7 下午 06:27:54
[程式片段][前台]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
|< …28293031323334353637… >|
頁數 37 / 53 上一頁 下一頁
~ Uwinfo ~