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
標籤
  • 當頁
  • [t]
  • �
  • C
  • end
  • User ORDER
  • 10
  • message
  • -5815
  • 0,
  • datetime
  • 0
  • 考試
  • db
  • [t],
  • big5 order
  • SVG
  • 專案
  • Data
  • ef
  • bugzilla
  • javascript
  • validation
  • ie
  • ��λ
  • tim2121121
  • 68
  • 超出最大
  • ti
  • chrome
  • 版本
  • OrderCompl
  • -2912
  • aspnet_reg
  • SQL 變更
  • UrlResult
  • sqldep
  • a
  • 試
  • 5151
  • blog
  • USER
  • Image
  • datagrid
  • weget
  • .
  • 36
  • sp_
  • 80
  • IIS AD
頁數 5 / 8 上一頁 下一頁
搜尋 UNT 結果:
自製 radio button & checkbox 的注意事項
自製input 的 radio button 和 checkbox 之前常見的做法是,在input旁邊加入:not(old)的選擇器,如下所例 (以下寫法為SCSS格式)

input[type="radio"]:not(old){
width:28px;
margin:0;
padding:0;
@include opacity(0);
}
input[type="radio"]:not(old) + label{
display: inline-block;
margin-left: -28px;
padding-left: 18px;
background: url("//www.shopunt.com/images/eng/btn/radio.png") no-repeat;
width:auto;
line-height: 12px;
}
input[type="radio"]:not(old):checked + label{
background: url("//www.shopunt.com/images/eng/btn/radio-r.png") no-repeat;
width:auto;
}


但是chrome的新版本(39版)後開始,不能直接在input旁邊加:not(old),這段語法,點擊後,會無法正常顯示,所以解決的方法有兩個
1. 要使用:not(old)這段語法,不能在input旁邊加,必須是在他的外層上加,如下所例

.r-btn:not(old){
    input[type="radio"]{
     width:28px;
     margin:0;
     padding:0;
     @include opacity(0);
    }
    input[type="radio"] + label{
     display: inline-block;
     margin-left: -28px;
     padding-left: 18px;
     background: url("//www.shopunt.com/images/eng/btn/radio.png") no-repeat;
     width:auto;
     line-height: 12px;
    }
    input[type="radio"]:checked + label{
     background: url("//www.shopunt.com/images/eng/btn/radio-r.png") no-repeat;
     width:auto;
    }
}


2. 不使用:not(old),改用:not(:checked)寫法,Selectors 4也建議使用此語法,如下所例
input[type="radio"]:not(:checked), input[type="radio"]:checked {
    position: absolute;
    left: -9999px;
}
input[type="radio"]:not(checked) + label{
display: inline-block;
margin-left: 4px;
padding-left: 18px;
background: url("//www.shopunt.com/images/eng/btn/radio.png") no-repeat;
width:auto;
line-height: 12px;
}
input[type="radio"]:checked + label{
background: url("//www.shopunt.com/images/eng/btn/radio-r.png") no-repeat;
width:auto;
}


 
More...
nelson, 2014/11/21 下午 07:04:21
適用於手機版網頁的 facebook feed 機制

對於PC版大尺吋的螢幕,當網站要 feed 資料到 facebook 時,可以使用 javascript SDK 的
FB.ui => method:'feed' 方式處理,參考位置。此方法會popup小視窗讓user可以分享資料出去。

但是遇到手機版網頁就有點麻煩,實測上手機版的 chrome 會出現轉不停的情況,無法分享;而iPhone則是另開新頁面處理,可以成功但是會多一個分頁。所以手機版網頁建議使用 redirect 方式處理分享機制,參考位置
​

    var fbUrl = "https://www.facebook.com/dialog/feed?" +
    "app_id=122465741241119&display=touch" +
    "&link=" + encodeURIComponent("http://www.shopunt.com/tch/FixPage.aspx?id=525") +
    "&picture=" + encodeURIComponent("http://www.shopunt.com/tch/event/2014-nail-enrollment/fb_200x200.jpg") +
    "&description=" + encodeURIComponent("市價不斐的光療DIY教學,UNT傾囊相授!10場巡迴免費教學,讓妳輕鬆掌握光療DIY訣竅,並搶先體驗秋冬最新流行色!現場打卡,再送時尚美甲工具組") +
    "&redirect_uri=" + encodeURIComponent("http://www.shopunt.com/tch/event/2014-nail-enrollment/Handler.ashx?fun=FBCallback");
​

當然以 redirect 處理與 javascript 方式處理是兩種不同的方式,redirect 方式的 callback 網址 (redirect_uri)要接收facebook 導回的 post_id , javascript 方式則是 callback function 處理 post_id

More...
darren, 2014/10/16 下午 03:48:04
SQL 搜尋時發生的奇怪現象與解決方法

半夜被老闆 Line,跟我說網頁發生錯誤,他無法看統計報表,會出現作業逾時的錯誤 我查了一下網頁程式,發現是這筆SQL指令跑太久
 Select Id, (IsNull(Total, 0) - IsNull(CouponDiscount, 0) + IsNull(CouponAdd, 0)) as Total, Buyer_Email, EN_Packing_List_Status, EN_Order_Source, En_Stock_Status, Create_Date
From V_Order_main With(Nolock)
Where Id in (select Order_Id from Ad_Trace With(NoLock) where (Parameter_Id = 14278))
AND Create_Date >= '2014/10/3' And Create_Date < '2014/10/12'

--> 跑了50秒~ 1分鐘

 Select Id, (IsNull(Total, 0) - IsNull(CouponDiscount, 0) + IsNull(CouponAdd, 0)) as Total, Buyer_Email, EN_Packing_List_Status, EN_Order_Source, En_Stock_Status, Create_Date
From V_Order_main With(Nolock)
Where Id in (select Order_Id from Ad_Trace With(NoLock) where (Parameter_Id = 14278))

--> 拿掉日期限制 > 秒殺,  結果跑出 47 筆資料

跑一下執行計畫 原來子查詢的 Ad_Trace 沒有建立Index造成


加上 Index 之後,再跑第一支SQL --> 秒殺

奇怪的地方:
明明訂單日期欄位(Create_Date) 跟 Ad_Trace 沒有多大關係,但是加上日期限制之後,居然會引發 Ad_Trace 搜尋過久的現象
他好像是先依照訂單日期找出所有訂單,然後再從子查詢 Ad_Trace 裡面搜尋有無符合的條件訂單
而不是先跑子查詢找出 Ad_Trace 所有的 Order_Id,再去找符合 Create_Date 的訂單

SQL內部運作的機制真是有點讓人想不透,幸好有評估計畫可以看出問題在哪裡
這讓我想起以前學SQL時的一句話 => 盡量用Join來取代子查詢
使用子查詢真的是效能殺手啊

------繼續補充--------------------------------------

上面的SQL在雙11活動後,由於當日訂單過多,一樣造成SQL timeout 的現象,研判還是子查詢造成的問題
Select Id, (IsNull(Total, 0) - IsNull(CouponDiscount, 0) + IsNull(CouponAdd, 0)) as Total, Buyer_Email, EN_Packing_List_Status, EN_Order_Source, En_Stock_Status, Create_Date
From V_Order_main With(Nolock)
Where Id in (select Order_Id from Ad_Trace With(NoLock) where (Parameter_Id = 14720))
And Create_Date > '2014-11-10' And Create_Date < '2014-11-11'

--> 跑了51秒

所以先將子查詢拿出來跑出一串字串 
865828,865890,865901,865903,865928,865955,865990,865993,866005,866035.....
(共1452筆)
再把他拼入sql跑   --> 7秒

 
More...
darren, 2014/10/11 上午 09:58:18
Cached DataTable 要注意的地方

網站開發,善用 Cached DataTable 可以使網站效能倍增,不必一直去資料庫抓資料。
但是使用 Cached DataTable 有一個地方要注意
就是他是 Shared 物件,表示同時有好幾個頁面都可以存取他

例如A網頁將資料抓出,然後變更裡面的DataRow資料,
另一個B網頁也會跟著變更

由於 Cached DataTable 在 Set DataRow Value 時
可能 Critical Section 沒有處理好,若真的同時多個thread 操作
會出現 Exception
(System.ArgumentOutOfRangeException: 索引超出範圍。必須為非負數且小於集合的大小。)

建議:

  • Cached DataTable 最好是只能用來讀,不要Set Value
  • 若需要Set Value,可以使用 DataTable Copy()功能,先複製出來再操作,就不會影響到原始資料

            '這是 UNT FixPage 物件抓取單一資料的範例
            Shared Function GetSpecialPage2FromCachedDT(ByVal Key As Int32) As DB.SpecialPage2
                Dim DT As DataTable = GetAllDataFromBaseTableWithCache()
                Dim Row As DataRow = DT.Rows.Find(Key)
                If Row IsNot Nothing Then
                    '避免每個thread都共用table 寫入資料會出現問題
                    Dim newDT As DataTable = DT.Clone()
                    newDT.ImportRow(Row)
                    Return New SpecialPage2(newDT.Rows(0))
                Else
                    Return Nothing
                End If
            End Function

More...
darren, 2014/9/23 下午 03:34:21
facebook 網頁分享 Debug 模式
當我們網站裡的某個網址要分享到 facebook 時,
facebook 會主動到我們網頁擷取內容,然後存在cache裡
facebook 給開發人員一個頁面可以測試看看結果
https://developers.facebook.com/tools/debug/og/object/ 
可以貼上自己網站的某個網址 ex.
http://www.shopunt.com/eng/unreal-touch-mineral-powder-blush/p/1129/c/34
就可以看到 facebook 爬到的結果,如果上次爬的是很久以前,這個地方也可以重新爬一次

----------------------------------------------------------------
經由測試結果,發現這功能出現的圖片,跟實際上在網站裡點fb分享出現的內容還是有差異
想出現的圖片還是不能控制,根據[此文章]說明
要把 og: 所有屬性都加上才行
header 圖片部分最好再加上
<link href="圖片連結網址" rel="image_src" type="image/jpeg">

應該就能保證分享圖片是自己想要的。 --> 這有空再來測試好了
 
More...
darren, 2014/8/13 下午 07:32:59
Convert.ToInt32 vs Int32.Parse
Convert.ToInt32 vs Int32.Parse
這兩者的差別在於 Convert 物件可傳入的值型別比較多,也可以傳入 null (Nothing) => 0
Int32.Parse只接受 string, 遇到 null (Nothing) 會引發 exception
轉換效能上 Int32.Parse 較佳,但除非是很大量的運算,兩者之間差別微乎其微

若擔心傳入的字串不是數值 會引發錯誤
除了可以使用 try catch 包起來 也可以用 Int32.TryParse 來處理

若是遇到 DB 的資料要轉換 記得要判別是不是 DBNull
Dim intCount As Integer = If(Convert.IsDBNull(row("count")), 0, Convert.ToInt32(row("count")))

// C#
int intCount = Convert.IsDBNull(row("count")) ? 0 : Convert.ToInt32(row("count"));


 
More...
darren, 2014/8/11 下午 01:45:22
.net 4.0 exception 潛在危險處理 - 自訂 RequestValidation
自從網站上了 net4.0 之後,網站會有為數不少的 "潛在危險" 的 exception
大都來自不友善的攻擊,想要測試網站的漏洞
網站做這層防護是好事,只是這個東西太敏感了,連簡單的冒號 & 符號都會跳 exception
更慘的是 Google Analytics 會在一些 user cookies 寫入xml文字 ( __utmz=... )
導致正常的 User 都不能正常瀏覽我們網站

解法有兩種:
1. 直接在 web.config 直接設定 不檢查
<system.web>
    <httpRuntime requestValidationMode="2.0" />
    <pages validateRequest="false" />
</system.web>

2. 自訂 RequestValidate (4.0以上才可以用)
請參考此文章 http://msdn.microsoft.com/en-us/library/system.web.util.requestvalidator(v=vs.100).aspx

後者比較算是正解 基本上處理掉 <script 我想 XSS 就解決一大半
 

More...
darren, 2014/7/22 上午 11:53:17
縮小背景圖片方法
 .mobile-share_fb{ display:block; background:url("http://www.shopunt.com/css/mobile/images/mobile-s9398562778.png") no-repeat; background-position: 0 -1648px; height: 80px; width: 80px;} 

 .shrink-attr{ background-size: 152px 2104px; width: 40px; height: 40px; background-position: 0 -824px;} 

 .fb-test{ display:block; background:url("http://www.shopunt.com/images/logo_welcome.jpg") no-repeat; background-size:50% 50%; width: 105px; height: 105px;} 


 
 
 
 
More...
nelson, 2014/7/7 上午 11:58:02
左邊 Menu 當scroll時固定位置的方法 js
這個活動頁左邊 menu 要固定位置 但是不能跑出框框外面
http://www.shopunt.com/tch/event/2014-naked-truth-cc-cream/

所以需要處理scroll物件


<div id="menuContainer">
  <div id="menu">
    <ul>
      <li>menu1</li>
      <li>menu2</li>
    </ul>
  </div>
  <div> ...長內容.... </div>
</div>

js
        var __ContainerHeight = 5000;
        var __ContainerTop = 160;
        var __MenuHeight = 550;
        var __FixedTop = 20;

        $(window).load(function () {

            __ContainerHeight = $("#menuContainer").height();
            __ContainerTop = $("#menuContainer").offset().top;
            __MenuHeight = $("#menu").height();

            $("#menu").css({ "top": __FixedTop + "px", "position": "absolute" });
            $(window).scroll(function () {
                var scrolls = $(this).scrollTop();
                //console.log(scrolls);
                if (scrolls < __ContainerTop) {
                    $("#menu").css({ "top": __FixedTop + "px", "position": "absolute" });
                }
                else if ((scrolls + __MenuHeight + __FixedTop) > (__ContainerHeight + __ContainerTop)) {
                    $("#menu").css({ "top": (__ContainerHeight - __MenuHeight) + "px", "position": "absolute" });
                }
                else {
                    $("#menu").css({ "top": __FixedTop + "px", "position": "fixed" });
                }
            });

        });

 
More...
darren, 2014/6/20 下午 02:03:01
UNT - UW.TBase 增加 strBodyTop 變數
由於偶爾會有需要在 <body> 最上方塞入一些 html
例如塞入一個要置頂的 div 區塊
目前這個區塊只有 {DebugMessage}

所以在 master.html 增加一個新的項目 叫做 <!--BodyTop--> 
<body>
    <!--BodyTop-->
    {DebugMessage}
    <a id="anchorGoTop" href="#gotop" class="gotop" style="display: none;"><span><em></em></span></a>

UW.TBase 增加一個 Public 變數  strBodyTop

如此一般網頁使用時 就可以置入置頂的內容 注意:是塞入html
使用上 於 PreRender 時
        '購物button區塊置於 <body> 正下方
        Me.strBodyTop = Me.otContent.SubTemplate("BuyButtonArea").Result
就可以了
 
More...
darren, 2014/6/20 上午 10:57:30
|< 12345678 >|
頁數 5 / 8 上一頁 下一頁
~ Uwinfo ~