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
標籤
  • wbirqcua
  • 102,
  • trigger
  • 12
  • 82 ORDER B
  • npoi
  • CKED ORDER
  • .
  • 效能
  • ip
  • a
  • aspnet_reg
  • 88 ORDER B
  • 8
  • bkXLPYQo
  • vb
  • ti
  • lvcfjvow
  • .net core
  • cell
  • asp.net#we
  • for
  • union21211
  • dxhizbma
  • -1068
  • 9DfnSreG
  • reiko
  • image
  • http error
  • git
  • datetime
  • Line
  • DB
  • 80
  • EnuM
  • -8154
  • requestval
  • shop
  • net
  • promise
  • UW
  • drop
  • 530
  • 784
  • IE
  • date
  • jquery
  • PG
  • tls1.0
  • SQL accoun
頁數 14 / 15 上一頁 下一頁
搜尋 if 結果:
Firefox 抓滑鼠在HTML Element上的位置
Firefox 沒有 offsetX 和 offsetY,解決方法是從父層把left 和top做累加。
    function getOffset(e) {
        /*e: Mousemove Event*/
        if (e.target.offsetLeft == undefined) {
            /*firefox only*/
            e.target = target.parentNode;
        }
        var tarPos = getTarPos(e.target);
        var tarMousePos = { x: window.pageXOffset + e.clientX, y: window.pageYOffset + e.clientY     };
        var offset = { offsetX: tarMousePos.x - tarPos.x, offsetY: tarMousePos.y - tarPos.y };
        return offset;
    }
    function getTarPos(el) {
        var page = { x: 0, y: 0 };
        while (el) {
            page.x += el.offsetLeft;
            page.y += el.offsetTop;
            el = el.offsetParent;
        }
        return page;
    }
More...
瞇瞇, 2012/5/31 下午 12:59:46
C# "??" 的運用
兩個問號相連可以處理原物件是 null 的情況簡潔寫法


// 當Form沒有傳入 ArticleCategory, 則回傳空值
string strCategoryIDs = Request.Form["ArticleCategory"] == null ? string.Empty : Request.Form["ArticleCategory"];
-->
string strCategoryIDs = Request.Form["ArticleCategory"] ?? string.Empty;
More...
darren, 2012/5/17 上午 11:12:48
不要再用 IIf 函式,請改用 If
VB 不知何時多了一個 if 函式, 可以用來取代 iif.

使用 iif 時, true part 和 false part 都會執行.

改用 if 就不會有這個問題, 比較像 AndAlso 和 OrElse 的行為. 有短路(short circuit)的特性. 會依據判斷式的結果只執行部份的結果.
IIf(X IsNot Nothing, X.qty, 0) --> 會有 Error

If(X IsNot Nothing, X.qty, 0) --> OK


2012/6/3 補述:
發現一個問題, 在 VS2010 中, If(X IsNot Nothing, X.qty, 0) 會造成 Compile 錯誤, 但網站是可以正常執行的..

這是 VS2010 的 Bug 嗎 ?

More...
Bike, 2012/5/16 上午 09:42:57
iframe裡的網頁網頁無法寫入cookie
當A網站的網頁裡面開一個iframe連結到B網站的網頁
結果B網站的Cookies卻一直無法寫入,最常顯示的狀況是session無效
如果發生這樣的狀況 請記得在 IIS 設定 http header, "P3P"
詳細參考 http://adamyoung.net/IE-Blocking-iFrame-Cookies
也可以參考 w3c P3P 
More...
darren, 2012/5/14 下午 05:32:09
跨瀏覽器網頁設計密技-From www
(1) 各瀏覽器 CSS Hacks 技巧
.page {
color: black; /* 所有瀏覽器 */
color /**/: green; /* IE7, IE8, IE9 */
*color: blue; /* IE6, IE7 */
_color: red; /* IE6 */
}



(2) IE 條件式註解
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>

※ 注意事項 ※
微軟已經決定 Internet Explorer 10 之後的版本將移除條件式註解功能,因此下一代 IE 瀏覽器在解析條件式註解時將會與現有其他瀏覽器一樣,針對條件式註解或條件式標籤裡的條件式都會自動忽略,因此未來該功能只能用於 IE9 以下的瀏覽器裡。

資料來源:http://blog.miniasp.com/post/2012/05/02/Building-Website-is-not-that-easy-CSS-Hacks-and-IE-Conditional-Comments.aspx

More...
Reiko, 2012/5/7 下午 12:03:35
SVN 修改 Memo (log message)
在 SVN 中, 對大型開發案而言, Commit  時的 Memo (log message) 會是很重要的東西. 但常常會忘了寫, 事後要修改才發現, 預設是不能改的. 若要修改, 在 D:\Repositories\Project Name\hooks 底下新增一個的 pre-revprop-change.bat 檔案, 只是每個 Project 都要分開加, 還滿討厭的...

pre-revprop-change.bat 的內容如下:
if "%4" == "svn:log" exit 0
echo Property '%4' cannot be changed >&2
exit 1

 

More...
Bike, 2012/5/3 下午 04:28:50
在列印前把列印的內容使用圖檔存備份
主要是使用 Printing.PreviewPrintController 的產生預覽圖片的功能來儲存列印內容, 再把圖片送到印表機, 以保証列印內容和儲存的圖檔是一致的. 值得一提的是, 在預覽時可以使用不同的印表機, 以便讓產生較小的圖檔, 否則有時會發生 GDI+ 的錯誤.

Sample 如下:

Imports System.Drawing.Printing

Namespace X
    Partial Public Class PrintSomething
        Dim PD As PrintDocument

        Dim ppc As New Printing.PreviewPrintController()

        Dim TotalPage As Int32 = 0

        ''' <summary>
        ''' 第幾次列印, 用來控制寫出的圖檔
        ''' </summary>
        ''' <remarks></remarks>
        Dim PrintCount As Int32 = 1

        Dim PageCount As Int32 = 1

            :
            :
            :
      
        Sub New(ByVal oPM As DB.PackingListMain, ByVal dtDetail As DataTable, dtUsedCoupon As DataTable)
            '初始化資料
            :
            :
            :
        End Sub

        Sub InitPrintDocument()
            '在這裡設定 PrintDocument 的紙張, 印表機, 邊界, 橫印或直印

            PD = New PrintDocument

            :
            :
            :

        End Sub

        Sub print()
            InitPrintDocument()

            PD.PrintController = ppc

           
            ' 第一次先把列印結果存在 Printing.PreviewPrintController 中
            AddHandler PD.PrintPage, AddressOf GeneratePreview

            '再來儲存圖片
            AddHandler PD.EndPrint, AddressOf SaveImage

            PD.Print()
        End Sub


        Dim ppi() As Printing.PreviewPageInfo
        Dim PrintPage As Int32 = 0

        Sub SaveImage(ByVal sender As Object, ByVal ev As PrintEventArgs)

            PrintDebug("Save Image Start, " & Now.ToString("yyyy-MM-dd HH:mm:ss.fff"))

            '把圖檔存起來
            Dim TF As String = Now.ToString("yyyyMMddHHmmss") ' DB.SysConfig.Path.LocalDataRoot
            Dim PathLocal As String = "C:\PrintLog\" & TF.Substring(0, 4) & "-" & TF.Substring(4, 2) & "\"
            Dim PathPackingListSheetImage As String = DB.SysConfig.PackingListSheetImage & TF.Substring(0, 4) & "-" & TF.Substring(4, 2) & "\"

            System.IO.Directory.CreateDirectory(PathLocal)
            System.IO.Directory.CreateDirectory(PathPackingListSheetImage)

            Dim LatestImages As String = ""
            ppi = ppc.GetPreviewPageInfo()

            For x As Integer = 0 To ppi.Length - 1
                Dim Filename As String = TF & "_" & Me.oPM.Id & "_" & x & ".png"

                ppi(x).Image.Save(PathLocal & Filename, System.Drawing.Imaging.ImageFormat.Png)
            Next


            '把圖檔印出來
            For x As Integer = 0 To ppi.Length - 1
  '建立新的 PrintDocument
                InitPrintDocument()

                If CST.WebConfig.Server_NAME = "測試主機" Then
                    UW.WU.DebugWriteLine("PrinterName: " & Me.PD.PrinterSettings.PrinterName)
                    UW.WU.DebugWriteLine("PaperSize: " & PD.DefaultPageSettings.PaperSize.PaperName)

                    PD.DocumentName = "PackingList"
                    PD.PrinterSettings.PrintFileName = "C:\PDF\PackingList" & Now.ToString("yyyyMMddHHmmss") & "_" & PrintPage & ".prn"
                    PD.PrinterSettings.PrintToFile = True

                    'PD.PrinterSettings.
                End If

                '很奇怪, 這裡不會分頁, 所以要一張一張印   
                AddHandler PD.PrintPage, AddressOf pd_PrintPage2
                PD.Print()


               PrintPage += 1

            Next
        End Sub

        Private Sub pd_PrintPage2(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
            '很奇怪, 這裡不會分頁, 所以要一張一張印           
            ev.Graphics.DrawImage(ppi(PrintPage).Image, 0, 0)
            ev.HasMorePages = False
        End Sub


        Private Sub GeneratePreview(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
            ' 列印內容
        End Sub

        End Class
    End Class

End Namespace

More...
Bike, 2012/5/3 下午 04:00:38
Select with XLock
在 Select 指令後, 依據結果做一些工作, 即使有 Transaction, 但還是有可能發生一致性的問題:

Ex:

        Dim Conn As SqlConnection = UW.SQL.GetOpenedConnection
        Dim Tran As SqlTransaction = Conn.BeginTransaction

        Try
            Dim C As Int32 = UW.SQL.GetSingleValue("Select Counter From TableA Where Id = 1", Tran)
            C = C + 1
            UW.SQL.executeSQL("Update TableA Set Counter = " & C & " Where  Id = 1", Tran)
            Tran.Commit()
        Catch ex As Exception
            Tran.Rollback()
            UW.WU.DebugWriteLine(ex.ToString, True, True)

        Finally
            If Conn.State <> ConnectionState.Closed Then
                Conn.Close()
            End If

        End Try


以上的程式由兩個 Session 同時執行時, 並不能保証 Counter 會被加 2

若是要保証兩個 Session 都會把 Counter 加一(總共加 2), 要把以下這一行

Dim C As Int32 = UW.SQL.GetSingleValue("Select Counter From TableA Where Id = 1", Tran)

改為

Dim C As Int32 = UW.SQL.GetSingleValue("Select Counter From TableA With(XLock) Where Id = 1", Tran)
More...
Bike, 2012/5/3 下午 03:02:16
Seagate硬碟壞了別急著丟!保固查詢,聯強維修&原價屋換貨?
http://portable.easylife.tw/3060?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+portableasylife+%28%E7%B6%A0%E8%89%B2%E5%B7%A5%E5%BB%A0+Easylife+Blog%29
More...
Reiko, 2012/4/25 下午 12:58:46
由於該物件目前的狀態,導致作業無效。
[InvalidOperationException: 由於該物件目前的狀態,導致作業無效。]
   System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2692302
   System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +61
   System.Web.HttpRequest.FillInFormCollection() +148

[HttpException (0x80004005): URL 編碼型式資料無效。]
   System.Web.HttpRequest.FillInFormCollection() +206
   System.Web.HttpRequest.get_Form() +68
   System.Web.HttpRequest.get_HasForm() +8735447
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97
   System.Web.UI.Page.DeterminePostBackMode() +63
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +133



Error Msg:



若你的 Web 應用程式真的會傳遞超過 1,000 個欄位時,這個預設值也是可以設定的,請修改網站根目錄下的 web.config 檔,並在 區段加上一組 aspnet:MaxHttpCollectionKeys 設定即可:

<appSettings>
 <add key="aspnet:MaxHttpCollectionKeys" value="2500" />
</appSettings>

參考說明:
http://blog.miniasp.com/post/2012/01/01/Efficient-Denial-of-Service-Attacks-on-Web-Application-Platforms.aspx
More...
Reiko, 2012/4/10 下午 08:11:15
|< …567891011121314… >|
頁數 14 / 15 上一頁 下一頁
~ Uwinfo ~