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
標籤
  • 許蓋功問題
  • C#
  • 740
  • 版本
  • date
  • Deadlock
  • c
  • 0 ORDER BY
  • SU
  • -1068
  • message
  • 上傳
  • IIS
  • 0,
  • z8pq1dyd
  • if
  • AD
  • backup
  • 20
  • 權限
  • GN
  • 6002121121
  • [U2]
  • [t]
  • firefox
  • a generic
  • table
  • LINE
  • data
  • a
  • 網站
  • linepay
  • query
  • 鎖定
  • d8yl.com
  • db
  • ORM
  • 600
  • MS8qKi9XQU
  • 檔案分享
  • 230
  • user
  • 帳號
  • SqlCacheTa
  • 0KeeTeamex
  • sql
  • 12
  • 28
  • 優缺點
  • 整數
頁數 3 / 3 上一頁
搜尋 prop 結果:
jquery 中判斷 checkbox 是否選取的不要再用 attr 要改用 prop
最近為了在 iframe 中的 history.goback 的問題,把後台的 jquery 升級到 1.10.1 版,結果發生讓 checkbox 全選的語法無效,原來是 attr('checked') 在 1.10.1 版中不會隨著 checkbox 是否選取而改變。


<input type="checkbox" onclick="if ($(this).attr('checked')) { $('.cbProducts').attr('checked', true) } else { $('.cbProducts').attr('checked', false) }" />

要換成

<input type="checkbox" onclick="if ($(this).prop('checked')) { $('.cbProducts').prop('checked', true) } else { $('.cbProducts').prop('checked', false) }" />


不過很麻煩節是,若是 jquery 1.5.x 及以前的版本是不支援 prop 的,請參考文章:
http://blog.xuite.net/vexed/tech/44905647-jQuery+1.6+.attr()+%E5%92%8C+.prop()

我先把後台的 MasterPageWithForm.master 由 1.10.1 改回 1.6.2 版, MasterPage.master 和 MasterPage_NoMenu.master 兩支程式的 jquery 由 1.5.1 改到 1.6.2 版。未來要升級 1.10.1 以上的版本時可能會需要大工程把 attr 改為 prop。 或是考慮用 

$.fn.attr = $.fn.prop;

來把整個 attr 改為 prop


 
More...
Bike, 2014/2/23 上午 02:57:24
Windows 2008 的 SMTP 寄信問題 (need fully-qualified hostname)

Windows 2008 的 SMTP 寄信時若遇到 "Helo command rejected: need fully-qualified hostname" ,可做以下的修改。

The fix is easy:

  1. Open IIS
  2. View the properties of you Default SMTP Virtual Server
  3. Go to the “Delivery” tab
  4. Click the “Advanced” button (in the bottom right corner)
  5. Under “Fully-qualified domain name” enter a domain name that points to the server
  6. Click Ok until you’re back to IIS
More...
Bike, 2013/10/28 上午 09:50:56
Find Collation of Database and Table Column Using T-SQL
/* Find Collation of SQL Server Database */
SELECT DATABASEPROPERTYEX('DBName', 'Collation')
GO
/* Find Collation of SQL Server Database Table Column */
USE sample
GO
SELECT name, collation_name
FROM sys.columns
WHERE OBJECT_ID IN (
SELECT OBJECT_ID FROM sys.objects WHERE type = 'U' AND name = 'TableName')
AND name = 'ColumnName'


參考:http://blog.sqlauthority.com/2008/12/16/sql-server-find-collation-of-database-and-table-column-using-t-sql/
More...
Reiko, 2013/5/15 上午 10:30:53
阻止事件傳到父物件(事件冒泡 event bubble up) stopPropagation
在某些情況下,return false 不能阻止事件傳到父物件。要使用以下的指令。

event.stopPropagation()

http://www.jb51.net/article/32792.htm
More...
Bike, 2013/4/16 上午 11:20:47
使用 Drag Drop 將檔案放入網頁上傳檔案 (HTML5)
  • How to Use HTML5 File Drag & Drop
  • How to Open Dropped Files Using HTML5 and JavaScript
  • How to Asynchronously Upload Files Using HTML5 and Ajax
  • How to Create File Upload Progress Bars in HTML5 and JavaScript

這幾篇文章提到使用拖拉方式將檔案放到網頁裡面
然後在本地端預覽,然後ajax上傳,上傳時還有 progress bar
一整套運作模式說明,並附上sample code,挺棒的
附檔sample code

-------------------------------------------
測試後補充:
1. 範例中的 dragover event 要改成 dragenter 比較正確
然後 dragover 最好是做成 return false (ev.stopPropagation())
2. Server端不能用Requst.Files收檔案,要直接處理 Request.InputStream另存成檔案

 
More...
darren, 2012/10/7 上午 01:20:42
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
VB 轉 C# 問題整理
之前將部分UW網站VB程式碼轉到C#,
我是用此工具轉
http://www.developerfusion.com/tools/convert/vb-to-csharp/
轉換後,放到visual studio還是有很多毛毛蟲
整理一些問題, 希望能減少轉換上的困難
 
1. Imports --> using (using 只能用namespace)
   System.Web.HttpContext 是不能放在using, 因為他是類別, 不是 namspace
   所以 Current.Session 要調整成 HttpContext.Current.Session
 
2. index或是key, value類的東西要用中括號 []
   VB:Session("name") --> C#:Session["name"]
   Cache(""), Application(""), DataRow("") 也是一樣
   
3. 所有方法都要加上 ()
   例如 ToString --> ToString()
   例如 ToLower --> ToLower()
 
4. 不能隱含式的型別轉換, 要明確
   轉換型態可以有以下方法
   - 轉字串時, 直接後面加上 .ToString()
   - Convert 物件轉換
   - 變數名稱前面加上(Type), 例如 (HashTable)Session["htData"]
   - 以 as 方式轉換, 若要轉換的物件可能是null建議用此方法, 例如 
     System.Net.HttpWebRequest http = System.Net.WebRequest.Create(Url) as System.Net.HttpWebRequest;
     string strData = HttpContext.Current.Cache["CacheName"] as string;
     用 as 方法不會強制轉換, 用 (Type) 或 ToString() 一旦遇到 null 會發生Exception
 
5. 帶參數的 Property C#是不允許的, .Net 會自動產生 get_ function 取代
   VB: UW.WU.URL --> C#: UW.WU.get_URL();
 
6. partial 要放在 public 後面
 
7. aspx頁面C#的檔頭要設定AutoEventWireup="true"
     另外所有的 server control 的 On Event 所執行的function name (例如 Button 的 OnClick)  都要在 aspx 裡面設定
   (這部分會在後台程式發生,因為轉換後常忘了加)
   <asp:DropDownList ID="ddlName" runat="server" AutoPostBack="true" 
      OnSelectedIndexChanged="ddlName_SelectedIndexChanged"></asp:DropDownList>
   <asp:Button ID="btnAdd" runat="server" Text="新增" OnClick="btnAdd_Click" />
 
8. 因為字串相加也是 +, 一些特殊寫法要注意
   VB: (Url & "Page=" & EndPage + 1)    --> VB會先將整數加好後再字串相加
   c#: (Url + "Page=" + (EndPage + 1))  --> 由於C#會先將1轉為字串再把所有字串相加 , 所以要先用括號包起來先讓整數相加

9. vbCrLf -> "\r\n"
    vbTab ->  "\t"

10. VB function 轉換 
    Conversion.Fix -> Math.Floor
     Strings.Format(x, "###0.0") -> 用 x.ToString("N1");

11. EN 處理要多加注意,需額外加 (int) 才會顯示數值,很多 sql 指令這樣拼要小心
" where EN_產品性質 = " + SHOPUNT.EN.產品性質.非成品 ; -> where EN_產品性質 = 非成品   (會出錯)
" where EN_產品性質 = " + (int)SHOPUNT.EN.產品性質.非成品; -> where EN_產品性質 = 100

先整理這些 以後遇到再加上


 
More...
darren, 2012/5/17 上午 10:50:34
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
SQL指令

刪除資料庫

DROP DATABASE name;

SQL版本查詢

SELECT SERVERPROPERTY('productversion')
SELECT SERVERPROPERTY ('productlevel')
SELECT SERVERPROPERTY ('edition')

 

with(nolock, index(IX_NTA_StayingRoomSales))

Select * From Table with(nolock, index(IX_NTA_StayingRoomSales)) Where AAAAA

More...
Reiko, 2012/4/12 下午 12:12:48
SQL 2008 Mirror Setting

Principal(來源), Mirror(鏡像), Witness(見證,非必要,系統出現錯誤時,自動切換資料庫)
上方三個資料庫需使用相同版本

/*查資料庫版本號*/
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'),SERVERPROPERTY ('edition')

 

參考資料:
MS SQL Server 2008_容錯轉移_資料庫鏡像實作

Simple Step by Step Database Mirroring
SQL Server 2008 的執行個體之間傳送登入和密碼
Troubleshooting Database Mirroring Error 1418
Microsoft SQL 2008 SERVER -- Fix : Error: 1418 Mirroring

/*
DB: Principal
Step 1, 備份來源資料庫
*/

backup database reikoTest to disk='D:\MirrorTEST_Full.bak'
with format
go

backup log reikoTest to disk='D:\MirrorTEST_log.bak'
go
 

/*
DB: Mirror
Step 2, 建立mirror資料庫
*/

Create database ReikoTEST
go

restore database ReikoTEST from disk='D:\MirrorTEST_Full.bak'
with replace, norecovery
go

restore log ReikoTESt from disk='D:\MirrorTEST_log.bak'
with norecovery
go

/*
DB: Principal
Step 3, 建立SQL Server 2008 的執行個體之間傳送登入和密碼
注意 這個指令碼會在 master 資料庫中建立兩個預存程序。這兩個預存程序名為 sp_hexadecimal 預存程序和 sp_help_revlogin 預存程序。

※第一次建立mirror時(預存程序不存在時),才需執行本指令
*/
SQL指令碼


/*
DB: Principal
Step 4, 查詢傳送登入帳號和密碼
sp_help_revlogin 預存程序所產生的輸出指令碼是登入指令碼。這個登入指令碼會建立具有原始「安全性識別碼」(SID) 和原始密碼的登入。
*/

EXEC sp_help_revlogin
/*
執行後,複製要使用的帳號,至mirror資料庫執行
ex.
-- Login:reiko
CREATE LOGIN [reiko] WITH PASSWORD = 0x010036D88E850F3F29E70120CB4CD2DEE7CBAD1AB83AA4A6A927 HASHED, SID = 0x495A943A23B12C48A43C39776B879A49, DEFAULT_DATABASE = [master], CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF
*/


/*
DB: Mirror
Step 5, 建立傳送登入帳號和密碼
刪掉DEFAULT_DATABASE = [master],(上方紅字部份)
ex.
-- Login:reiko
CREATE LOGIN [reiko] WITH PASSWORD = 0x010036D88E850F3F29E70120CB4CD2DEE7CBAD1AB83AA4A6A927 HASHED, SID = 0x495A943A23B12C48A43C39776B879A49, CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF
*/

-- Login:reiko
CREATE LOGIN [reiko] WITH PASSWORD = 0x010036D88E850F3F29E70120CB4CD2DEE7CBAD1AB83AA4A6A927 HASHED, SID = 0x495A943A23B12C48A43C39776B879A49, CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF
 

PS.刪除誤建的帳號密碼:DROP LOGIN [reiko]
More...
Reiko, 2012/4/9 下午 07:38:16
|< 123 >|
頁數 3 / 3 上一頁
~ Uwinfo ~