發表文章

目前顯示的是 2013的文章

MS SQL Select 亂數

SELECT TOP 100 * FROM table ORDER BY NEWID()

tree 檔案 匯出樹狀圖

圖片
TREE [drive:][path] [/F] [/A] 可列出樹狀圖

FileUpload 限制檔案類型 正規表示式

msdn 上面寫的FileUpload 副檔名驗證 並不能在一開始瀏覽時即限定可選擇檔案類型 <%@ Page Language="VB" %> FileUpload Class Example Select a file to upload: 但我們可以優化將多個檔案類型使用正規表示式去做驗證

查看Linux版本

有以下命令可以查看: # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: CentOS Description: CentOS release 5.4 (Final) Release: 5.4 Codename: Final 這個命令適用於所有的linux,包括Redhat、SuSE、Debian等發行版本。 root@MyMail ~ # uname Linux root@MyMail ~ # uname -r 2.6.18-164.el5 以下二種方法適用於RedHat,CentOS root@MyMail ~ # cat /etc/redhat-release CentOS release 5.4 (Final) 登錄到linux執行rpm -q redhat-release #rpm -q redhat-release 或CentOS root@MyMail ~ # rpm -q centos-release centos-release-5-4.el5.centos.1

tinymce IE 11 功能錯誤

圖片
 win7及win8將ie自動到ie11時 真的是一堆災難產出 tinymce 的html 發生功能錯誤 如下:

[.NET] 解決 System.Web.HttpException 超出最大的要求長度

圖片
maxRequestLength 在 Machine.config 檔案所定義的預設上限值 4096 (4 MB) 當資料量大時會出現  超出最大的要求長度 解決方法: 在web.config 更改預設值 <System.Web>     <httpRuntime maxRequestLength="10240" /> </System.Web> 

抓取 Youtube 影片擷圖

Youtube 影片擷圖 影片網址: http://www.youtube.com/watch?v= yBkGD3X6xAw &feature=share&list=UUWkSEajwnKiEl00dllPNYpA 取出代碼:yBkGD3X6xAw 將代碼明套入截圖網址:

防止網頁被別人嵌入 iframe x-frame-options 設定

x-frame-options 可防止嶔入有三種模式如下: · DENY Deny all attempts to frame the page · SAMEORIGIN The page can be framed by another page only if it belongs to the same origin as the page being framed · ALLOW-FROM origin Developers can specify a list of trusted origins in the origin attribute. Only pages on origin are permitted to load this page inside an iframe

[MS SQL]Select 重覆資料;只顯示重覆資料 SQL 語法

只select出重覆出資料或不重覆資料 Select 語法 如下:

[MS SQL] 修改資料表時,發生「不允許儲存變更 。…」訊息

圖片
訊息如下: 不允許儲存變更。您所做的變更需要卸除並重新建立下列的資料表。您已進行至資料表,且無法重新建立或啟用 [防止儲存變更] 選項的變更需要重新建立資料表。

[Colorbox] 被影片播放器壓住

因為在使用embed 或object播放影片 是啟用內建的播放器,做為播放 當他按下play時,啟動內建播放器 他的層級是非常高的 暫用此方法來規避按播放時,影片永遠在top壓圖的情況發生 將程式碼放置影片的地方

[ASP.NET] 您必須使用角色管理工具來安裝或設定 Microsoft .NET Framework 3.5 SP1

圖片
自行下載Framework 獨立安裝時 出現以下錯誤訊息 您必須使用角色管理工具來安裝或設定 Microsoft .NET Framework 3.5 SP1

電腦單位換算

1. Bit位元:一個電流的開(1)或關(0),是電腦的最小、最基本單位。 2. Byte位元組:是資料常用的基本單位,表示一個英文字母。   字組Word:2個Byte組合成一個Word,表示一個中文字(全形字)。 3. KB (Kilo Byte):千位元組,常用於表示檔案大小。 4. MB (Mega Byte):百萬位元組,用於表示電腦主記憶容量。 5. GB (Giga Byte):十億位元組,用於表示硬碟容量。 6. TB (Tera Byte):兆位元組。 1Bybes=8Bit 1KB=1024Bytes 1MB=1024KB 1GB=1024MB 1TB=1024GB 1PB=1024TB 1EB=1024PB 1ZB=1024EB

[SQL Server] 附加資料庫失敗 Error Code 5120

圖片
 附加資料庫失敗 錯誤碼 5120

[MySql] 最大連線數、連線數查詢設定

#查詢目前連線數 mysql> show processlist; #查詢目前最大連線數 mysql> show variables like ‘max_connections’;

[ASP.NET][MySQL] .net的connector 錯誤 Authentication with old password no longer supported, use 4.1 style passwords.

.net的connector 錯誤訊息 Authentication with old password no longer supported, use 4.1 style passwords.  MysqL Connector/NET 6.6.x (as of 6.6.2) dropped support for old password style authentication (it was deprecated due to being insecure and there were documented ways to attack it). .net的connector 已經拋棄了舊的密碼方式, 只支援新的密碼方式. 所以導致.net 新舊格式不一,所以連不上

[Windows] 使用遠端桌面傳送檔案

圖片
遠端桌面是可以傳檔案的 只要在一開始連線的時候設定即可 1.切換到「本機資源」

[MySql] 清空資料表 清空資料庫

清空資料表: truncate table  tb_name; 清空資料庫: 查出資料庫所有table名稱 select table_name from information_schema.tables where TABLE_SCHEMA = 'databaseName' 可以用excel 或其他工具copy出來編輯 執行n行 truncate table  tb_name;

[facebook] 縮圖抓取錯誤或指定縮圖

圖片
貼上facebook link 縮圖有時候不會是你想要的或是廣告圖 重新發布後,想換都換不了! 這個時候就直接連到fb的debug 頁面 

[ASP.NET] [VB] DataTable Select distinct 應用

distinct  用法 Dim dt As Data.DataTable = TableSource() Dim SColumn() As String = {"column1", "column2"} Dim dt2 As Data.DataTable = dt.DefaultView.ToTable( True , SColumn) dt2 結果為distinct  後的結果 DataTable複製數筆DataRow到另外一個DataTable Dim dt As Data.DataTable = TableSource() Dim dtRow() As Data.DataRow = dt.Select("ID=10" ) Dim dtTemp As Data.DataTable = dt.Clone() If dtRow.Length > 0 Then      For j As Integer = 0 To dtRow.Length - 1              dtTemp.ImportRow(dtRow(j))      Next End If dtTemp結果為Select後的結果 這時候不可以使用 dtTemp.Rows.Add(dtRow(j)) 會出現"這個資料列已經屬於其他資料表"的錯誤

[MySQL] ERROR: Unable to retrieve stored procedure metadata for routine

Unable to retrieve stored procedure metadata for routine 'BindSiteTree'.  Either grant  SELECT privilege to mysql.proc for this user or use "check parameters=false" with  your connection string. 將連線字串加上check parameters=false,即可解決 應該有回傳的欄位值對應的錯誤。 應詳細找出!

MySQL 中文亂碼,查詢編碼,修正編碼

先查詢資料庫編碼是否為外文 SHOW CREATE DATABASE dbName 資料庫改為utf-8 編碼 mysql> Alter database `dbName` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.42 sec) 完成。

MySQL 更改root密碼 (忘記密碼)

先將mysql停止  #service mysqld stop  將mysqld啟動並設為無登入控制模式  #mysqld_safe --skip-grant-tables& 

[linux][centos] 防火牆設定 增加允許port

防火牆關閉 /etc/init.d/iptables stop 防火牆狀態查詢 /etc/init.d/iptables status

VM 開機時自動啟動指令(bat 批次檔)

首先,先找出自己VM的EXE檔位置 例如:"C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe" 再找出要啟動的VM檔位值 例如: "D:\VM_Files\win2003\Windows Server 2003 Enterprise Edition.vmx"

CentOS 設定日期和時間 自動同步 圖形化操作

圖片
CentOS 灌起來,時間老是不對,調了重開機還是一樣會時間lag~ 圖形化介面操作如下, Step 1

[MySql][ASP.net] 使用 Parameters 方法 LIKE 如何寫? Using Parameters in MySQL LIKE query

使用Parameters 去做like的查詢 一直無法working 以下是錯誤示範 Using Cmd As New MySqlCommand Cmd.CommandText = "Select * From TableName Where Column like %?KeyWord%" Cmd.Parameters.Add(New MySqlParameter("?KeyWord", keyWord)) ...(略) End Using Using Cmd As New MySqlCommand Cmd.CommandText = "Select * From TableName Where Column like '%?KeyWord%'" Cmd.Parameters.Add(New MySqlParameter("?KeyWord", keyWord)) ...(略) End Using 試了好久,查了資料,以下這個寫法才能正常運作, 但我不知道是不是很好的答案 Using Cmd As New MySqlCommand Cmd.CommandText = "Select * From TableName Where Column like ?KeyWord" Cmd.Parameters.Add(New MySqlParameter("?KeyWord", "%" & keyWord & "%")) ...(略) End Using 如果有其他比較好的答案 煩請留言給我了 謝謝

Android 安裝Flash Player

圖片
新的android 不再內建flash啦 怎麼辦??!!!!! 還是有很多的網址是採用很不友善的flash為主要內容 外出查資料、查地址、查電話 遇到flash網站的話,真的就欲哭無淚了 不過,還好只是android預設拿掉以及在gooogle paly 搜尋不到而已

robots.txt 設定

使用 robots.txt 檔案來攔截或移除網頁 最簡單的 robots.txt 檔案使用兩項規則: User-agent :遵循以下規則的漫遊器 Disallow :您想要封鎖的網址

上傳檔案大小的限制 iis7

錯誤:要求篩選模組設定為拒絕超過要求內容長度的要求。 iis7前上傳檔案大小的限制是在 web.config 的 maxRequestLength 屬性 maxRequestLength:上傳檔案長度,預設4mb,單位kb

ASP.net 取得虛擬目錄名稱

方法1: Request.Url.GetLeftPart(UriPartial.Authority) & Request.ApplicationPath 方法2: VirtualPathUtility.GetDirectory(Request.Path)

系統自動關機排程 Windows 8,Windows 7,Windows Server 2008, Windows XP, Windows Server 2003,

圖片
使用狀況:如遇可預警停電,可讓系統正常關機 使用windows內建的排定的工作(工作排程器) 選取程式及設定參數(如附圖) C:\windows\system32\shutdown.exe

online HtmlEncode HtmlDecode

在左方input區域貼上你想要轉換的字 結果會顯示在右方 Encode或Decode請自行選擇 htmlEncode input result htmlDecode input result

{夯} 螞蟻文產生器 ҉螞҉蟻҉文҉產҉生҉器҉

最近流行這個 fb、line、任何可留言的都是這個 呼~ ҉矮҉額҉ ҉這҉東҉東҉ ҉為҉什҉麼҉要҉把҉閱҉讀҉變҉的҉那҉麼҉累҉呢҉!҉ 把文字貼在這個方框,再按螞蟻化即可產生 快貼吧! 這應該是原po啦!

{Jquery} Colorbox postback 回來後物件值消失解決方法

Colorbox postback後值一直不見 找了很久,原來是 colorbox重寫了物件的 東西被丟到FROM外面了,所以才會一直抓不到值 以下為解決方法 找到jquery.colorbox裡的 function appendHTML 將//的文字取代為粗體字即可

{IE} IE8 IE9 IE10 fckeditor 不能使用 BUG

圖片
 IE8以上 錯誤: 物件沒有支援這個屬性或方法 'selectSingleNode'

{MS SQL} INSERT、匯入後變問號

遇到某些中文難字、日文 INSERT 時在資料庫顯示會變在問號??呈現 一般寫法: INSERT INTO TableName (Column1, Column2) VALUES ('value1','Value2') 只需要將語法修改如下: INSERT INTO TableName (Column1, Column2) VALUES ( N 'value1', N 'Value2') 記得欄位要是 nvarchar 或 nchar 型態

{IE} FreeTextBox with IE10 bug

圖片
IE更新版本多,bug也跟著多 莫名奇妙問題也多! 錯誤: 無法設定未定義或 Null 參考的屬性 'ftb' 目前似乎無解 新的專案就先不要用了 如果是舊專案就忍著點,暫用以下方式修改吧! <meta http-equiv="X-UA-Compatible" content="IE=9" > FreeTextBox http://www.freetextbox.com/demos/

{ASP.Net} 將 ViewState 加密

● ASP.NET 1.1  在 Web.Config 內做設定  <configuration>        <system.web>           <machineKey validation="3DES" />        </system.web>     </configuration> ●ASP.NET 2.0  在 Web.Config 做設定  <configuration>         <system.web>                <pages viewStateEncryptionMode="Auto" />         </system.web>      </configuration> 每個 Page 做設定  <%@Page ViewStateEncryptionMode="Always" %>  ViewStateEncryptionMode 有三種模式可設定,          a. Auto - 如果控制項呼叫 RegisterRequiresViewStateEncryption 方法要求加密,則 ViewState 資訊會加密。          b. Always - ViewState 資訊永遠加密。          c. Never - ViewState 永遠不加密,即使控制項要求加密。

正規表示式整理表

正規表示式的特定字元 說明 等效的正規表示式 \d 數字 [0-9] \D 非數字 [^0-9] \w 數字、字母、底線 [a-zA-Z0-9_] \W 非  \w [^a-zA-Z0-9_] \s 空白字元 [ \r\t\n\f] \S 非空白字元 [^ \r\t\n\f]

網址url 正規表示式

"(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?" Public Shared Function RegURL(ByVal strParam As String) As Boolean Dim r As Regex = New Regex("(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?") Dim m As Match = r.Match(strParam) If m.Success And m.Length = Len(strParam) Then Return True Else Return False End If End Function