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
標籤
  • TCP2121121
  • l82fY1iV
  • Viewstate
  • https
  • find
  • .
  • VS
  • 1722121121
  • -9825 ORDE
  • -5809
  • 92
  • 56
  • Request bo
  • Certificat
  • 80
  • UW
  • 5Lypiz1J
  • missor
  • abort
  • 8
  • images2121
  • entify
  • asp
  • EN
  • Su
  • 1
  • web.config
  • end[t]
  • config
  • vb
  • CK
  • NS1NO
  • 14
  • bike
  • union21211
  • load
  • Nanoha
  • DB
  • ti
  • 62
  • isnull
  • Contains
  • death lock
  • CS
  • 發現有些圖片
  • 0.6avnc
  • 191
  • GN
  • 16
  • UNT
搜尋 Trigger 結果:
關於 PostgreSQL
-- 自動更新某個欄位

CREATE OR REPLACE FUNCTION before_market_update ()
RETURNS TRIGGER AS 
$$
BEGIN
    NEW.LMDT = LocalTimeStamp;
    RETURN NEW;
END;
$$
LANGUAGE 'plpgsql';

CREATE TRIGGER updt_market
  BEFORE UPDATE
  ON "Market"
  FOR EACH ROW
  EXECUTE PROCEDURE before_market_update();
More...
Bike, 2022/8/12 下午 09:25:57
PostgreSQL 的 monitor trigger
--建立 table (要記得改 XXX)
CREATE TABLE IF NOT EXISTS public.table_monitor
(
    table_name text COLLATE pg_catalog."default" NOT NULL,
    update_at timestamp without time zone NOT NULL DEFAULT now(),
    update_count bigint NOT NULL DEFAULT 0,
    CONSTRAINT table_monitor_pkey PRIMARY KEY (table_name)
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.table_monitor
    OWNER to XXX;

-- 這一段只要執行一次
CREATE OR REPLACE FUNCTION public.table_monitor_trigger_fnc()
    RETURNS trigger
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE NOT LEAKPROOF
AS $BODY$
BEGIN
     Update public.table_monitor Set update_count = update_count + 1, update_at = now()  Where table_name = TG_TABLE_NAME; 
RETURN NEW;
END;
$BODY$;

ALTER FUNCTION public.table_monitor_trigger_fnc()
    OWNER TO XXX;

-- 對於被監控的 table, 要執行以下的指令,記得 monitor_table_name 要改為 table 的名字(要符合大小寫)
INSERT INTO public.table_monitor (table_name, update_at, update_count) VALUES ('monitor_table_name', '2000-01-01', 0) ON CONFLICT DO NOTHING;

CREATE OR REPLACE TRIGGER table_monitor_trigger
    AFTER INSERT OR DELETE OR UPDATE 
    ON monitor_table_name
    FOR EACH STATEMENT
    EXECUTE FUNCTION public.table_monitor_trigger_fnc();

監控用的程式碼:
public static void UpdateTableCache()
{
    //標記自已是正在執行的 Thread. 讓舊的 Thread 在執行完畢之後, 應該會自動結束. 以防舊的 Thread 執行超過 10 秒.
    CurrentThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;

    try
    {
        //確認自已是正在執行的 Thread, 重覆執行. (另一個 Thread 插入執行)
        while (CurrentThreadId == System.Threading.Thread.CurrentThread.ManagedThreadId)
        {
            LastUpdateDate = DateTime.Now;

            foreach (var dbId in CachedDbs)
            {
                var sql = @"select * from table_monitor";

                var dt = Su.PgSql.DtFromSql(sql, dbId);

                foreach (DataRow row in dt.Rows)
                {
                    string changeId = row["update_count"].DBNullToDefault();
                    string CacheKey = TableCacheKey(dbId, row["table_name"].DBNullToDefault());
                    ObjectCache cache = MemoryCache.Default;

                    string OldValue = (string)cache[CacheKey];

                    if (OldValue == null)
                    {
                        cache.Set(CacheKey, changeId, DateTime.MaxValue);
                    }
                    else
                    {
                        if (changeId != OldValue)
                        {
                            cache.Remove(CacheKey);
                            cache.Set(CacheKey, changeId, DateTime.MaxValue);
                        }
                    }
                }
            }

            //每兩秒檢查一次
            System.Threading.Thread.Sleep(2000);
        }
    }
    catch (Exception)
    {
        //依經驗, 只要 DB 能通, 這裡幾乎不會有問題, 所以這裡暫時不處理, 未來有問題時可以考慮寫入文字檔比較好.
    }
}
More...
Bike, 2022/7/20 上午 10:05:39
另開新視窗測試 -- 待測試
Browser:
safari in iphone 
chrome in iphone
chrome in android
in Line (APP)
in FB (APP)

HTML:
form target="_blank"
window.open
link target="_blank"

Trigger:
onclick in tag
.click with jquery
submit button
More...
Bike, 2022/2/11 上午 09:13:12
在 MySQL 建立 Cache 用的 Trigger
use clinic;

INSERT INTO change_notification(`table_name`) VALUES('sys_config');

drop trigger if exists au_sys_config;
drop trigger if exists ai_sys_config;
drop trigger if exists ad_sys_config;

delimiter |

CREATE TRIGGER au_sys_config after UPDATE ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|

CREATE TRIGGER ai_sys_config after INSERT ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|

CREATE TRIGGER ad_sys_config after Delete ON `sys_config`
FOR EACH ROW
BEGIN
DECLARE v_row_count int DEFAULT row_count();
IF v_row_count!=1 THEN
update change_notification set change_count = change_count + 1, update_date = now() where table_name = 'sys_config';
END IF;
END;
|

delimiter ;
More...
Bike, 2019/11/6 下午 07:17:50
分頁套件PageShift2

前台要引用
<!--AutoScripts S-->PageShift2<!--AutoScripts E-->
<!--AutoCSS S-->2013UI/PageShift<!--AutoCSS E-->

內文架構要有
<div id="PageShift2" class="page-index"></div>
<script>
        $('#PageShift2').PageShift2({
            PageIndex: 1,
            PageMAX: 10,
            TriggerEvent: ChangePage
        });
        function ChangePage(PageIndex) {
            console.log(PageIndex);
        }
</script>
More...
Doug, 2014/3/18 下午 06:32:41
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
global.asax 的事件
從 http://blog.ie-soft.de/post/2007/12/globalasax-events.aspx  抄來的. 留作參考

HttpApplication Events:

Application_AcquireRequestState
Occurs when ASP.NET acquires the current state (for example, session state) that is associated with the current request. 

Application_AuthenticateRequest
Occurs when a security module has established the identity of the user. 

Application_AuthorizeRequest
Occurs when a security module has verified user authorization. 

Application_BeginRequest
Occurs as the first event in the HTTP pipeline chain of execution when ASP.NET responds to a request. 

Application_Disposed
Adds an event handler to listen to the Disposed event on the application. 

Application_EndRequest
Occurs as the last event in the HTTP pipeline chain of execution when ASP.NET responds to a request. 

Application_Error
Occurs when an unhandled exception is thrown. 

Application_PostAcquireRequestState
Occurs when the request state (for example, session state) that is associated with the current request has been obtained. 

Application_PostAuthenticateRequest
Occurs when a security module has established the identity of the user. 

Application_PostAuthorizeRequest
Occurs when the user for the current request has been authorized. 

Application_PostMapRequestHandler
Occurs when ASP.NET has mapped the current request to the appropriate event handler. 

Application_PostReleaseRequestState
Occurs when ASP.NET has completed executing all request event handlers and the request state data has been stored. 

Application_PostRequestHandlerExecute
Occurs when the ASP.NET event handler (for example, a page or an XML Web service) finishes execution. 

Application_PostResolveRequestCache
Occurs when ASP.NET bypasses execution of the current event handler and allows a caching module to serve a request from the cache. 

Application_PostUpdateRequestCache
Occurs when ASP.NET completes updating caching modules and storing responses that are used to serve subsequent requests from the cache. 

Application_PreRequestHandlerExecute
Occurs just before ASP.NET begins executing an event handler (for example, a page or an XML Web service). 

Application_PreSendRequestContent
Occurs just before ASP.NET sends content to the client. 

Application_PreSendRequestHeaders
Occurs just before ASP.NET sends HTTP headers to the client. 

Application_ReleaseRequestState
Occurs after ASP.NET finishes executing all request event handlers. This event causes state modules to save the current state data. 

Application_ResolveRequestCache
Occurs when ASP.NET completes an authorization event to let the caching modules serve requests from the cache, bypassing execution of the event handler (for example, a page or an XML Web service). 

Application_UpdateRequestCache
Occurs when ASP.NET finishes executing an event handler in order to let caching modules store responses that will be used to serve subsequent requests from the cache. 

Application_Init
This method occurs after _start and is used for initializing code. 

Application_Start
As with traditional ASP, used to set up an application environment and only called when the application first starts.

Application_End
Again, like classic ASP, used to clean up variables and memory when an application ends.

Session Events:

Session_Start
As with classic ASP, this event is triggered when any new user accesses the web site.

Session_End
As with classic ASP, this event is triggered when a user's session times out or ends. Note this can be 20 mins (the default session timeout value) after the user actually leaves the site.

Profile Events:

Profile_MigrateAnonymous
Occurs when the anonymous user for a profile logs in.

Passport Events:

PassportAuthentication_OnAuthenticate
Raised during authentication. This is a Global.asax event that must be named PassportAuthentication_OnAuthenticate.
 

Possibly more events defined in other HttpModules like:

System.Web.Caching.OutputCacheModule
System.Web.SessionState.SessionStateModule
System.Web.Security.WindowsAuthentication
System.Web.Security.FormsAuthenticationModule
System.Web.Security.PassportAuthenticationModule
System.Web.Security.UrlAuthorizationModule
System.Web.Security.FileAuthorizationModule
System.Web.Profile.ProfileModule

More...
Bike, 2012/6/9 上午 08:55:08
~ Uwinfo ~