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
標籤
  • 380
  • Ubuntu
  • C212112112
  • SU
  • aspjpeg
  • ad
  • [t]
  • User
  • nsftw
  • [U2]
  • query
  • Chrome
  • 878
  • 1
  • Image
  • orm
  • 100
  • sw
  • UWInfo
  • Doug
  • intlTelInp
  • date
  • JsonConver
  • EN
  • replace
  • config
  • dns
  • Contains-t
  • 超出最大長度
  • HTML 的上標字與
  • blog
  • CacheDepen
  • server
  • Cache ORDE
  • Big5 ORDER
  • 9900222
  • 9247
  • SQL2008
  • 8308
  • 8122121121
  • 694
  • 6325
  • 2VcOh0l5
  • 2821211211
  • 1341
  • 134.5gvxb
  • -8695
  • ValidatePa
  • SqlDepende
  • ef
頁數 11 / 13 上一頁 下一頁
搜尋 SU 結果:
程式技巧: 以字串陣列來取代拼字串
最近看到一些 javascript 範例 覺得這樣不錯的
就是用 array push, join 方式來拼字串

    var Data = [{"key": "key5", "value": "value5"}, {"key": "key4", "value": "value4"}, {"key": "key3", "value": "value3"}];
    var html = [];
    html.push('<select name="test">');
    for (var i = 0; i < Data.length; i++) {
        html.push('<option value="' + Data[i]["key"] + '">',
            Data[i]["value"],
            "</option>");
    }
    html.push('</select>');
    return html.join('');


同樣的方式 .net 也可以這樣做

        List<string> listOfString = new List<string>();
        for (int i = 0; i < 10; i++)
        {
            listOfString.Add(i.ToString());
        }
        string strResult = string.Join(", ", listOfString.ToArray());


用這種方式也省的判別最後一筆要不要加上分隔符號
More...
darren, 2012/10/17 下午 04:09:20
SQL 2008 Express安裝問題
參考:Microsoft® SQL Server® 2008 Express安裝步驟指南

※Microsoft® SQL Server® 2008 Express with Tools此版本才有管理工具。

必備元件

Microsoft .NET Framework 3.5 Service pack 1(不裝連安裝畫面都無法開啟)
http://www.microsoft.com/downloads/details.aspx?FamilyId=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=zh-tw


Windows Installer 4.5 Redistributable - 繁體中文(不安裝就無法安裝SQL Server 2008)
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=5a58b56f-60b6-4412-95b9-54d056d6f9f4

PowerShell 1.0(不裝在檢查元件步驟就無法通過)
926139:Windows PowerShell 1.0 英文語言安裝封裝適用於 Windows Server 2003 及 Windows XP
926140:Windows Server 2003 Service Pack 1 與 Windows XP Service Pack 2 的 Windows PowerShell 1.0 當地語系化安裝套件
926141:Windows 1.0 PowerShell 多語系使用者語言介面 (MUI) Pack 適用於 Windows Server 2003 或適用於 Windows XP
928439:適用於 Windows Vista 的 Windows PowerShell 1.0 安裝封裝




※MSXML 6 SP2 會造成 SQL Server 2008 安裝失敗
解:先移除掉 MSXML 6 SP2,安裝完 SQL Server  2008 後,再更新 HotFix 一次
http://byronhu.wordpress.com/2008/12/25/msxml-6-sp2-%E6%9C%83%E9%80%A0%E6%88%90-sql-server-2008-%E5%AE%89%E8%A3%9D%E5%A4%B1%E6%95%97/


More...
Reiko, 2012/10/16 下午 01:00:50
Jquery Ajax error 之 parsererror 訊息
最近弄ajax 發現一個現象 先記起來一下
當 ajax dataType 是 json 時
            $.ajax({
                cache: false,
                data: "fun=SetAsBestAnswer&aid=" + articleId + "&rid=" + replyId,
                dataType: "json",
                success: function (objData, strTextStatus) {
                ...........

response的文字它會自動轉為物件,是以 jQuery.parseJSON 處理轉為此範例的 objData
但是有時會發生 parsererror 的錯誤
後來我發現是因為json 的 key 值必須要雙引號包起來才可以
然後字串內容也不能有斜線+單引號 \'   所以以下三者都是會失敗的
{test: "I'm a student."} 
{'test': "I'm a student."}
{"test": "I\'m a student."}

以下兩個都是OK的
{"test": "I'm a student."} --> OK
{"test": "I\u0027m a student."} --> OK


More...
darren, 2012/8/17 上午 11:39:28
各瀏覽器中cookie個數和大小限制

各瀏覽器中cookie個數和大小限制

 
 
 
 
 
 

一、瀏覽器允許每個域名所包含的cookie數
Microsoft指出InternetExplorer8增加cookie限制為每個域名50個,但IE7似乎也允許每個域名50個cookie。
Firefox每個域名cookie限制為50個。
Opera每個域名cookie限制為30個。
Safari/WebKit似乎沒有cookie限制。但是如果cookie很多,則會使header大小超過服務器的處理的限制,會導致錯誤發生。

二、當很多的cookie被設置,瀏覽器如何處理
除了Safari (可以設置全部cookie,不管數量多少),有兩個方法:
最少最近使用(leastrecentlyused(LRU))的方法:當cookie已達到限額,自動踢除最老的cookie,以使給最新的cookie一些空間。 InternetExplorer和Opera使用此方法。
Firefox很獨特:雖然最後的設置的cookie始終保留,但似乎隨機決定哪些cookie被保留。似乎沒有任何計劃(建議:在Firefox中不要超過cookie限制)。

三、不同瀏覽器的cookie總大小也不同
Firefox和Safari允許cookie多達4097個字節,包括名(name)、值(value)和等號。
Opera允許cookie多達4096個字節,包括:名(name)、值(value)和等號。
InternetExplorer允許cookie多達4095個字節,包括:名(name)、值(value)和等號。
註:多字節字符計算為兩個字節。在所有瀏覽器中,任何cookie大小超過限制都被忽略,且永遠不會被設置。

某網站的實測結果 http://www.ruslog.com/tools/cookies.html

Browser Max Cookies Max Size Per Cookie Max Size Per Domain1 Usage2
Chrome 4        
Chrome 5 70 4096 bytes NA  
Chrome 6 70 4096 bytes NA  
Chrome 7 70 4096 bytes NA  
Chrome 8 180 4096 bytes NA 0.6%
Chrome 9       7.7%
Chrome 10 180 4096 bytes NA 14.8%
Chrome 11       0.8%
Chrome 12       0.1%
FireFox 2 50 4097 characters NA  
FireFox 3 50 4097 characters NA 36.7%
FireFox 4 50 4098 characters NA 5.2%
IE 6 50 4096 characters 4096 characters 3.0%
IE 7 50 4095 characters 4095 characters 5.4%
IE 8 50 5117 characters 10234 characters 16.3%
IE 9       1.1%
Opera 8 30 4096 bytes 4096 bytes  
Opera 9 30 4096 bytes 4096 bytes  
Opera 10       0.2%
Opera 11 60 4096 bytes 4096 bytes 1.9%
Safari 3       0.1%
Safari 4       0.3%
Safari 5 600 4096 bytes 4096 bytes 3.6%
Safari on mac3 ? ? ?  


但是都找不到 IE9 的限制..
More...
Bike, 2012/7/11 下午 12:21:42
VS2010 中, 在方案總管和編輯的檔案同步 (在方案總管中追蹤現用項目)
有時 VS2010 會不知原因的方案總管不會自動移到目前編輯的檔案的位置, 有點不方便. 要改回同步, 可以勾選 "在方案總管中追蹤現用項目", 如下圖:

要重開 Visual Studio 才會生效。

More...
Bike, 2012/6/14 下午 04:42:37
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
便用非管理者帳戶來執行網站, 會遇到載入 DLL 的問題 -- 無法載入檔案或組件 XXX 或其相依性的其中之一。 存在某個不正常的 API 呼叫。
我今天試著建立一個一般的使用者帳號來執行某個網站 (<identity impersonate="true" userName="XXX" password="abcdefg"/>) , 遇到以下的問題, 結果把該使用者加入 IIS_IUSRS 就 OK 了.

無法載入檔案或組件 'FredCK.FCKeditorV2' 或其相依性的其中之一。 存在某個不正常的 API 呼叫。 (發生例外狀況於 HRESULT: 0x800300FA (STG_E_ABNORMALAPIEXIT))

 
More...
Bike, 2012/6/9 上午 08:26:48
查看資料庫最耗時的Sql Command
從網路找到改良的,直接查不用開Sql Profiler

加入可指定資料庫的改良
SELECT TOP 100 execution_count, total_worker_time, last_worker_time, max_worker_time, min_worker_time, CONVERT(INT, att.value) AS dbid, DB_NAME(CONVERT(INT, att.value)) as dbname ,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,((CASE statement_end_offset WHEN -1 THEN DATALENGTH(st.text)ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) + 1) as statement_text
FROM sys.dm_exec_query_stats as qs 
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as st
CROSS APPLY sys.dm_exec_plan_attributes(qs.plan_handle) att
WHERE att.attribute='dbid' and DB_NAME(CONVERT(INT, att.value)) = 'P9'
ORDER BY execution_count DESC 


以執行次數排序,可檢查爆量的Sql
Where statement_start_offset =0 測起來可以篩掉系統的Query,如:AspNet_SqlCache
SELECT TOP 10 execution_count, total_worker_time, last_worker_time, max_worker_time, min_worker_time, SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,((CASE statement_end_offset WHEN -1 THEN DATALENGTH(st.text)ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) + 1) as statement_text
FROM sys.dm_exec_query_stats as qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as st
WHERE statement_start_offset = 0
ORDER BY execution_count DESC  


以總執行時間排序,檢查寫耗時的Sql
SELECT TOP 10 total_worker_time, last_worker_time, max_worker_time, min_worker_time, SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,((CASE statement_end_offset WHEN -1 THEN DATALENGTH(st.text)ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) + 1) as statement_text
FROM sys.dm_exec_query_stats as qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as st
ORDER BY max_worker_time DESC


結果如下


 
More...
Jerry, 2012/6/8 下午 12:50:24
Squid Proxy 設定
Squid Proxy 相關處理

主站
http://www.squid-cache.org/

Windows 版本
http://squid.acmeconsulting.it/

解壓縮至 c:\squid

指令
\sbin\squid.exe
squid -?
squid -z d:\squid\var\cache 暫存目錄設定
squid -i 加入服務
squid -n Squid -k reconfigure 設定檔更新可重置,重啟服務也可以

設定檔
\etc\squid.conf
建議co個用過的來抄

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
將某一檔案更新做法
C:\squid\bin>squidclient -h localhost -p 80 -m PURGE http://bserver.img.photosharp.com.tw/Image/Advert/360x120_v1_260x87s120.jpg

若不行需設定 squid.conf
參考 http://help.getbusi.com/kb/getbusi-alert-advance/removing-individual-objects-from-squid-cache
acl manager proto cache_object 後加入一行 acl Purge method PURGE
http_access allow manager localhost 後加入一行 http_access allow localhost Purge
http_access deny manager 後加入一行 http_access deny Purge

設定檔重置
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Web & Squid 共存(不同 IP 共用80Port)

如 192.168.0.203(Web), 192.168.0.201(Squid)
IIS 的網站需指定(192.168.0.203)

squid.conf 設定檔需修改 IP 位置
http_port 192.168.0.201:80 transparent

改變 IIS 監聽 IP 的範圍
=-=-=-= Windows Server 2003 =-=-=-=
Windows Server 2003 CD\Support\Tools\Support.msi 安裝後
C:\Program Files\Support Tools 下有程式 httpcfg
httpcfg delete iplisten -i 0.0.0.0
httpcfg set iplisten -i 192.168.0.203
=-=-=-= Windows Server 2008 =-=-=-=
netsh 進入指令模式
netsh>http
netsh http>add iplisten ipaddress=192.168.0.203:80 (會取代 0.0.0.0)

重啟指令
net stop http /y
net start w3svc查看指令

netstat -an
tcp 0.0.0.0:80 需沒有
tcp 192.168.0.203:80 需有

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList
會列出開機時會載入的 httpcfg set iplisten,若 ip 有設錯 iis 可能會出現 "指定的網路名稱格式不正確"
 

More...
Jerry, 2012/6/8 下午 12:46:09
在 Chrome 中, 直接把剪貼簿(Clipboard)中的圖片用貼上的方式上傳到 Server
Client Side 的 HTML 如下: (若要在 CKEditor 中使用, 請參考: CKEditor 中貼上剪貼簿(clipboard) 中的圖片)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="/Scripts/jquery-1.7.1.min.js"></script>

<script type="text/javascript">
$(document).ready(function () {
$(window).bind("paste", function () {
if (event.clipboardData) {
var clipboardData, found;
found = false;
clipboardData = event.clipboardData;

Array.prototype.forEach.call(clipboardData.items, function (item, i) {
if (item.type.indexOf("image") !== -1) {
var blob = clipboardData.items[i].getAsFile();
var URL = window.URL || window.webkitURL;
var source = URL.createObjectURL(blob);

pastedImage = new Image();
pastedImage.src = source;
pastedImage.onload = function () {
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");

canvas.width = pastedImage.width;
canvas.height = pastedImage.height;
ctx.drawImage(pastedImage, 0, 0);

var base64 = canvas.toDataURL();
base64 = base64.substring(base64.indexOf("iVBOR"));

$.ajax({
url: "/API/AddTaskImages.aspx",
async: false,
type: "POST",
data: ({
Image: base64
}),
dataType: "html",
success: function (msg) {
var oRes;
try {
oRes = eval(msg);
}
catch (err) {
alert("無法解析傳回資料 !");
alert(msg);
alert(err);
}
if (oRes.success) {
alert("Upload Success..");
//alert(oRes.msg);
$("#MyImageDataLoadDemo").attr("src", oRes.msg);
} else {
alert(oRes.msg);
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
})
};

return false;
}
});
}
});
});
</script>
</head>
<body>



<div id="hold">
<div id="imgHold"><img src="" id="MyImageDataLoadDemo"></div>
<div>Click on the area above and ctrl+p an image to paste</div>
</div>
</body>
</html>



Server Side 的程式碼如下:

Partial Class API_AddTaskImages
Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
'DB.sysconfig.Path.TaskAttachment

Dim Base64 As String = Me.Request("Image")
'UW.JSON.WriteErrorMessage(Base64)

'Return


Dim imageBytes As Byte() = Convert.FromBase64String(Me.Request("Image"))

Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream(imageBytes, 0, imageBytes.Length)

ms.Write(imageBytes, 0, imageBytes.Length)
Dim image As System.Drawing.Image = System.Drawing.Image.FromStream(ms, True)

Dim map As Bitmap


Dim Filename As String = Now.ToString("yyyyMMddHHmmssfff") & ".png"

Try
System.IO.Directory.CreateDirectory(DB.sysconfig.Path.TaskAttachment & "UploadImages")
image.Save(DB.sysconfig.Path.TaskAttachment & "UploadImages\" & Filename, System.Drawing.Imaging.ImageFormat.Png)

UW.JSON.WriteSuccessMessage(DB.sysconfig.URL.TaskAttachment & "UploadImages/" & Filename)
Catch ex As Exception
UW.JSON.WriteErrorMessage(ex.ToString)
End Try

End Sub
End Class
More...
Bike, 2012/6/3 上午 02:33:36
|< …234567891011… >|
頁數 11 / 13 上一頁 下一頁
~ Uwinfo ~