2012/12/14

SQL Server Express 版本差異

目前 SQL Server 2012 SP1 Express 的 with tool 版 在安裝時已經可以帶進階 SSMS 工具了

需要 Profiler 的人可以考慮安裝免費授權即可

-- 以下原文 --

解了我長久以來的心頭之惑啊 囧

如果要用到Reporting Service 就裝Advanced Services版本

不然裝 with Tools就可以了這樣


2012/09/20

Windows 7 下面 User 的 Guest 權限


不知道為什麼指派使用者權限不能夠指派成Guest 只有 Admin 跟 User

後來找 windows 7 讓使用者自動登入的方法時意外找到

1.cmd.exe 執行 netplwiz ( XP 改用 control userpasswords2 )

2.反白要變更的使用者 選內容 -> 群組成員資格 點其他


如果要讓電腦能自動登入,反白要自動登入的使用者後取消勾選 "必須輸入名稱密碼"

之後確定,會問你反白的使用者密碼,輸入後完成

之後就會自動用選取的使用者帳號登入


--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.54.218

2012/07/24

64bit 版本 IIS 執行 32bit 組件的問題

無法載入檔案或組件 'xxxx' 或其相依性的其中之一。 試圖載入格式錯誤的程式。
描述: 在執行目前 Web 要求的過程中發生未處理的例外情形。請檢閱堆疊追蹤以取得錯
誤的詳細資訊,以及在程式碼中產生的位置。

例外詳細資訊: System.BadImageFormatException: 無法載入檔案或組件 'nfop' 或其相
依性的其中之一。 試圖載入格式錯誤的程式。

原始程式錯誤:

在執行目前 Web 要求期間,產生未處理的例外狀況。如需有關例外狀況來源與位置的資
訊,可以使用下列的例外狀況堆疊追蹤取得。

組件載入追蹤: 下列資訊在確定為何無法載入組件 'nfop' 時是有幫助的。


警告: 組件繫結記錄切換為 OFF。
若要記錄組件繫結失敗,請將登錄值 [HKLM\Software\Microsoft\Fusion!EnableLog]
(DWORD) 設為 1。
注意: 與組件繫結失敗記錄相關的效能會有部分負面影響。
若要關閉此功能,請移除登錄值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

解法:


Crystal Report @ .Net 4.x

問題:
Crystal Report 無法 於.Net 4.0環境下運行

發現方法:
使用神奇的Fiddler監控http/https資料流(無法監控localhost路徑,需打ip繞過)

發現錯誤:
C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319 目錄中沒有
crystalreportviewers12

解決方法:

2012/06/17

Asp.net 動態變更Site.Map

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

Handles Me.Load

Web.SiteMap.CurrentNode.ReadOnly = False

Web.SiteMap.CurrentNode.Title = "123"

Label1.Text = SiteMap.CurrentNode.Title

End Sub


--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.54.106

2012/06/15

IIF(Eval("value")) in ASP.Net

the Eval function doesn't exist in the current version of FIM. For a
complete list of available functions, go to the FIM home page, click on the
All Resources menu, and then on the Functions resource type.

The only option available to you AFAIK is to use nested IIF statements, e.g.

IIF (condition1,'value1',IIF(condition2,'value2','value3'))




--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 111.248.108.186

2012/06/13

Repeater.headertemplate 使用Bind/Eval

headertemplate 似乎無法使用 <%# Eval("name") %> 來做資料庫的欄位繫結

但 Repeater 控件也只能做單向繫結而已(讀出)

所以可以用以下方法

ASPX


<asp:repeater id="Repeater1" runat="server" datasourceid="SqlDataSource1">
        <headertemplate>
                <p>
                        <%# Message %>
                </p>
        </headertemplate>
        <itemtemplate>
                <%# Eval("Name") %>
        </itemtemplate>
        <separatortemplate>
                <br />
        </separatortemplate>
</asp:repeater>


CODE-BEHIND 的寫法則是

protected string Message
{
get {
         return "Hello World!";
      }
}

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.62.79
→Corsair:http://forums.asp.net/t/1188170.aspx/1 推 06/13 11:14

2012/05/29

ASP.Net MVC Paging

MEMO

http://blogs.taiga.nl/martijn/tag/paging/


ASP.Net MVC3 的外國豬走路影片

看點部落的暗黑執行緒大大的 ASP.NET MVC 3 豬走路範例系列

http://blog.darkthread.net/post-2011-04-11-asp-net-mvc3-intro-1.aspx

後面的回文有人提到說


    報告,我看過外國豬走路!

    走得很不錯:http://www.asp.net/mvc/pluralsight


記錄一下  學習國外的豬都怎麼走

--

http://blog.miniasp.com/category/ASPNET-MVC.aspx

保哥的 MVC 文章整理 (目前手上的工具書也是保哥出的)

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.60.240


2012/05/23

[TECH] T-SQL 達成 MySQL Limit 函式的方法

SELECT TOP 2 *
FROM [Categories]
 WHERE CategoryID NOT IN(
     SELECT TOP 5 CategoryID FROM [Categories] ORDER BY CategoryID
)


2012/05/22

IIS 7.5 managed pipeline mode

HTTP 錯誤 500.23 - Internal Server Error
偵測出 ASP.NET 設定沒有套用到整合式 Managed 管線模式。

-----

老師說上面這個是翻譯錯誤


2012/05/10

ASP.Net DropDownList 給預設空值的方法

DropDownList做DataBind之後預設選項就是在index = 1的位置

這樣如果要用 autoPostBack 查尋第一筆資料 就得先選到其他筆資料再切回第一筆

解法有2 如下:


1.用程式控制

DropDownList1.Items.Insert(index,item);


2.從屬性修改

  2.1.編輯項目給一個Value為 0 or null 的 "請選擇" (需注意WHERE=NULL問題)

  2.2切換到DropDownList1的屬性頁面 將 AppendDataBoundItems="True"


--

這大概跟 if(!Page.isPostBack) 並列來 iiiedu 的兩大收獲吧 0rz

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.58.56
→ tnav:偷偷藏一個AppendDataBoundItems的屬性確實滿驚人的...|||  推 05/10 23:43
→ Corsair:大概就跟gridview自動產生欄位的勾勾一樣的驚人         推 05/11 02:06

FCKEditor - fckconfig.js參數

純memo



2012/05/08

使用 AnkhSVN + TortoiseSVN 為 Visual Studio 2010 進行版本控管

以下內容轉自自己的痞客邦~ 因為最近project的需求而稍微試了一下發現挺好用而且設定的步驟也不會太複雜

寫一篇簡單的MEMO來記錄順便也讓大家看看


2012/04/19

2012/04/17

Gridview 跨欄置中


GridViewRow head = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);

TableCell header = new TableCell();
header.Text = "最新10筆";
header.HorizontalAlign = HorizontalAlign.Center;
header.ColumnSpan = 3;
header.BorderWidth = 0;
header.Font.Bold = true;
header.BackColor = System.Drawing.Color.Aqua;
head.Cells.Add(header);
GridViewTop10.Controls[0].Controls.AddAt(0, head);

必須要使用程式控制才行 = = 控件用選的沒得選


2012/04/10

2012/04/05

Visual Studio .config 加解密


http://msdn.microsoft.com/zh-tw/library/ms254494.aspx
http://www.dotblogs.com.tw/yc421206/archive/2009/04/15/8010.aspx

WinForm:

    // Takes the executable file name without the
    // .config extension.
    try
    {
        // Open the configuration file and retrieve
        // the connectionStrings section.
        Configuration config = ConfigurationManager.
            OpenExeConfiguration(ConfigurationUserLevel.None);

        ConnectionStringsSection section =
            config.GetSection("connectionStrings")
            as ConnectionStringsSection;

        if (section.SectionInformation.IsProtected)
        {
            // Remove encryption.
            section.SectionInformation.UnprotectSection();
        }
        else
        {
            // Encrypt the section.
            section.SectionInformation.ProtectSection(
                "DataProtectionConfigurationProvider");
        }
        // Save the current configuration.
        config.Save();
        MessageBox.Show(String.Format("Protected={0}",
section.SectionInformation.IsProtected));
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }



WebConfig:

    // Open the Web.config file.
    Configuration config = WebConfigurationManager.
        OpenWebConfiguration("~");

    // Get the connectionStrings section.
    ConnectionStringsSection section =
        config.GetSection("connectionStrings")
        as ConnectionStringsSection;

    // Toggle encryption.
    if (section.SectionInformation.IsProtected)
    {
        section.SectionInformation.UnprotectSection();
    }
    else
    {
        section.SectionInformation.ProtectSection(
            "DataProtectionConfigurationProvider");
    }

    // Save changes to the Web.config file.
    config.Save();    // Open the Web.config file.
    Configuration config = WebConfigurationManager.
        OpenWebConfiguration("~");

    // Get the connectionStrings section.
    ConnectionStringsSection section =
        config.GetSection("connectionStrings")
        as ConnectionStringsSection;

    // Toggle encryption.
    if (section.SectionInformation.IsProtected)
    {
        section.SectionInformation.UnprotectSection();
    }
    else
    {
        section.SectionInformation.ProtectSection(
            "DataProtectionConfigurationProvider");
    }

    // Save changes to the Web.config file.
    config.Save();

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 111.248.107.123

2012/04/03

Web.Config vs Bin

要放在同一層才有用 0rz

把web.config 放在wwwroot/web下面  可是bin放在wwwroot下面這樣會讀不到....

搞半天讀不到FCKeditor的問題竟然是這種蠢包

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 61.224.48.4

2012/03/23

C# Regular Expression Examples

───────────────────────────────────────

http://renjin.blogspot.com/2008/08/regular-expression-examples.html

http://219.85.62.1/Canred/showtopic.aspx?topicid=1229




"^\\d+$"  //非負整數(正整數 + 0)

"^[0-9]*[1-9][0-9]*$"  //正整數

"^((-\\d+)|(0+))$"  //非正整數(負整數 + 0)

"^-[0-9]*[1-9][0-9]*$"  //負整數

"^-?\\d+$"    //整數

"^\\d+(\\.\\d+)?$"  //非負浮點數(正浮點數 + 0)


"^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]
//正浮點數

"^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$"  //非正浮點數(負浮點數 + 0)


"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-
 9]*)))$"
//負浮點數

"^(-?\\d+)(\\.\\d+)?$"  //浮點數

"^[A-Za-z]+$"  //由26個英文字母組成的字符串

"^[A-Z]+$"  //由26個英文字母的大寫組成的字符串

"^[a-z]+$"  //由26個英文字母的小寫組成的字符串

"^[A-Za-z0-9]+$"  //由數字和26個英文字母組成的字符串

"^\\w+$"  //由數字、26個英文字母或者下劃線組成的字符串

"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$"    //email地址

"^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$"  //url

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 61.224.49.164

37 Tested Regular Expressions

http://www.virtuosimedia.com/dev/php/37-tested-php-perl-and-javascript-regular-expressions

2012/03/19

Array in C#

知道Array怎麼運作

但是好像不太習慣C#/Java的Array宣告方式 XD (跟平常比較多寫js/as有關係嗎? XD)


一維陣列 (C# 程式設計手冊)
http://msdn.microsoft.com/zh-tw/library/0a7fscd0(VS.80).aspx

宣告:
int[] array = new int[5];
string[] stringArray = new string[6];

初始化:
int[] array1 = new int[5] { 1, 3, 5, 7, 9 };
string[] weekDays = new string[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri",
"Sat" };

或是不用new一個陣列直接塞值進去

int[] array2 = { 1, 3, 5, 7, 9 };
string[] weekDays2 = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };


BUT 將陣列指派給這個變數時,就必須使用 new 運算子。例如:

int[] array3;
array3 = new int[] { 1, 3, 5, 7, 9 };   // OK
//array3 = {1, 3, 5, 7, 9};   // Error


另外二維以上多維陣列宣告法為 int[維度] ary = new int[長度]


int[,] array = new int[4, 2];

int[, ,] array1 = new int[4, 2, 3];

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.63.151

2012/03/08

HTML5 & CSS3 懶人包

HTML5 & CSS3 懶人包

1.Ryan的線上講義
http://www.slideshare.net/ryan/html5-basic
http://www.slideshare.net/ryan/some-html5-samples
http://www.slideshare.net/ryan/css3-basic

2.入門看這裡
http://www.w3schools.com/html5/default.asp
http://www.w3schools.com/css3/default.asp

3.延伸閱讀
http://www.html5rocks.com/en/
http://diveintohtml5.info/

4.相容分析
http://caniuse.com/
http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML5)

5.中文參考書
http://www.tenlong.com.tw/items/9574428656?item_id=57719
http://www.tenlong.com.tw/items/9862014504?item_id=244059

6.高級範例
http://www.apple.com/html5/

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.53.174
→ pxxxxxxg:W3School 要小心...  另外我自己是都看 MDN            推 03/09 00:50
→ Corsair:MDN是....?                                           推 03/09 12:38
→ pxxxxxxg:https://developer.mozilla.org/zh-TW/                推 03/11 01:29
→ Corsair:m(_  _)m  謝謝光大大                                 推 03/11 02:06

2012/02/21

Regular Expression in JavaScript

出處:http://blog.roodo.com/rocksaying/archives/2670695.html

^
寫在 pattern 第一個位置時,表示其後一符號必須出現在字串開頭的位置。寫在
 pattern 中間位置時則為否定之意,表示字串中不可有 ^ 之後一符號的內容。

$
寫在 pattern 最後一個位置時,表示其前一符號必須出現在字串尾端的位置。寫在
 pattern 中時無特別意義。

*
表示字串中有 0 到無數個其前一符號的內容。

+
表示字串中有 1 到無數個其前一符號的內容。

?
表示字串中有 0 到 1個其前一符號的內容。

{ }
表示前一符號在字串中的重覆次數。例如 /A{2}/ 表示 'A' 重覆兩次 (即 'AA') ;
/A{2,}/ 表示字串含有 2 到無數多個 'A' ;/A{2,5}/ 表示含有 2 到 5 個 'A' 。

.
表示一個任意字元。

[ ]
表示字串含有括號中任一字元的內容。可以 - 表示一組連續字元,例如 /[a-z]/,
/[0-9]/ 。注意, [] 僅代表一個字元,例如 /[abc]/ 表示 'a' 或 'b' 或 'c' ,而不
是 'abc' 。

( )
表示一個 sub pattern ,符合 sub pattern 的字串內容會被存放在匹配陣列中,並依序
指派數字代表此 sub pattern 。可以此數字在 pattern 的其他地方引用內容,例如
 /The h([0-9]) means Title (\1)/ 表示第 1 個 sub pattern 是 0 到 9 的任一字元
,而 \1 表示匹配的內容。故 'The h1 means Title 1', 'The h2 means Title 2' 到
 'The h9 means Title 9' 符合規則。

\
表示轉義 (escaping) ,將其後的字元視為一般字元。例如要表示字串中含有 '/' 字元
時,就必須寫作 /\// 。

|
「或」意,字串中含有 '|' 之前一符號或後一符號的內容。例如 /image\.(jpg|png)/
表示 'image.jpg' 或 'image.png' 。通常會用 () 括住 '|' 的前後符號。

\d
表示任何一個數字,意同 [0-9] 。

\D
表示任何一個非數字,意同 [^0-9] 。

\w
表示任何一個字元與數字以及 '_' ,意同 [a-zA-Z0-9_] 。

\W
表示任何一個 \w 以外的字元。

\s
表示任何一個空白符號,包括 \t, \v 等。

\S
表示任何一個非空白符號。



--

尾軟的MSDN上也有詳細的說明

http://msdn.microsoft.com/zh-tw/library/ae5bf541

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.49.171

Ryan Chung's slideshare

http://www.slideshare.net/ryan/presentations

元智資工的學長  資策會講師

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.49.171

2012/02/17

IIS7 + Visual 2010

1.安裝IIS7,需包含

    [IIS 6 管理相容性] → [IIS Metabase 及 IIS 6 設定相容性]

     (我找不到Metabase...  全部都中文的)

    [WWW服務] → [安全性] → [Windows 驗證] & [基本驗證]

    [WWW服務] → [應用程式開發功能] → [ASP.NET]



2.安裝Visual Studio (0rz....

  建立新專案後在專案總管內專案名稱上按右鍵 → 屬性  → [Web]

  下拉至伺服器位置 選擇 "使用本機IIS Web伺服器" 即可


--

感覺在筆記兩年前就該會的事情 = =

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 1.160.24.36

2012/02/16

SqlCommand 類別

http://msdn.microsoft.com/zh-tw/library/system.data.sqlclient.sqlcommand(v=vs.80).aspx


BeginExecuteNonQuery
啟始這個 SqlCommand 所描述之 Transact-SQL 陳述式或預存程序的非同步
 (Asynchronous) 執行,通常執行命令,例如 INSERT、DELETE、UPDATE 和 SET 陳述式
。每次呼叫 BeginExecuteNonQuery 都必須搭配呼叫完成作業 (通常在其他執行緒上) 的
 EndExecuteNonQuery。


BeginExecuteReader
啟始這個 SqlCommand 所描述之 Transact-SQL 陳述式或預存程序的非同步執行,並從伺
服器擷取一或多個結果集。每次呼叫 BeginExecuteReader 都必須搭配呼叫完成作業 (通
常在其他執行緒上) 的 EndExecuteReader。

BeginExecuteXmlReader
啟始這個 SqlCommand 所描述之 Transact-SQL 陳述式或預存程序的非同步執行。每次呼
叫 BeginExecuteXmlReader 都必須搭配呼叫完成作業 (通常在其他執行緒上) 的
 EndExecuteXmlReader,並傳回 XmlReader 物件。


ExecuteReader
執行傳回資料列的命令。為了增進效能,ExecuteReader 會使用 Transact-SQL
sp_executesql 系統預存程序來叫用 (Invoke) 命令。因此,如果 ExecuteReader 用於
執行 Transact-SQL SET 陳述式之類的命令,則可能不會產生所要的效果。


ExecuteNonQuery
執行命令,例如 Transact-SQL INSERT、DELELE、UPDATE 和 SET 陳述式。


ExecuteScalar
從資料庫中擷取單一值 (如彙總值)。


ExecuteXmlReader
將 CommandText 傳送至 Connection,並建置 XmlReader 物件。


private static void ReadOrderData(string connectionString)
{
    string queryString =
        "SELECT OrderID, CustomerID FROM dbo.Orders;";
    using (SqlConnection connection = new SqlConnection(
               connectionString))
    {
        SqlCommand command = new SqlCommand(
            queryString, connection);
        connection.Open();
        SqlDataReader reader = command.ExecuteReader();
        try
        {
            while (reader.Read())
            {
                Console.WriteLine(String.Format("{0}, {1}",
                    reader[0], reader[1]));
            }
        }
        finally
        {
            // Always call Close when done reading.
            reader.Close();
        }
    }
}

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 1.160.24.36