Archive

Archive for the ‘Others’ Category

How to add filter to CuteFtp

March 24, 2011 Leave a comment

Select the site manager>preference

 

 

 

 

 

 

 

 

 

 

 

 

Categories: Others Tags:

Visual Studio 2010 單鍵發行簡單使用

March 9, 2011 Leave a comment

Visual Studio 2010 單鍵發行簡單使用 Web.Release.config

Visual Studio 2010 版提供了一個相當方便的功能【單鍵發行】讓網站開發者只需要花費一次的時間就可以享受到往後的便利,在使用 Visual Studio 2008以前版本想要達到【單鍵發行】需要安裝 Web Deployment Project 既然現在內建了,那就應該是要會用,設定方法已經有很多文章可以搜尋的到了,所以這裡 demo 簡單的介紹 新增的 兩種 Web.Config 內的 Web.Release.config 設定方法

專案建立後可以看到 Web.config 變成有包含 Group Item 的樣子,點下去就可以看到多了Web.Release.configWeb.Debug.config 兩個檔案


demo廢言本文的重點是 Web.Release.config 因為 Web.Debug.config 通常就是預設的 Web.config 而且設定方法都一樣所以不介紹它,點開 Web.Release.config 後會看到以下詳盡的註解

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?xmlversion="1.0"encoding="utf-8"?>
<!-- 有關使用 web.config 轉換的詳細資訊,請造訪 http://go.microsoft.com/fwlink/?LinkId=125889 -->
  
  <!--
    在下面的範例中,"SetAttributes" 轉換只會在 "Match" 定位程式找到
    值為 "MyDB" 的屬性 "name" 時,才將 "connectionString" 的值變
    更為使用 "ReleaseSQLServer"。
      
    <connectionStrings>
      <add name="MyDB"
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
  -->
  <system.web>
    <compilationxdt:Transform="RemoveAttributes(debug)"/>
    <!--
      在下面的範例中,"Replace" 轉換將會取代 web.config 檔案
      的整個 <customErrors> 區段。
      請注意,因為在 <system.web> 節點之下
      只有一個 customErrors 區段,所以不需要使用 "xdt:Locator" 屬性。
        
      <customErrors defaultRedirect="GenericError.htm"
        mode="RemoteOnly" xdt:Transform="Replace">
        <error statusCode="500" redirect="InternalError.htm"/>
      </customErrors>
    -->
  </system.web>
</configuration>

●以上的註解其實還滿容易了解的,拿一個簡單範例來說

假設在開發環境中你的 資料庫位置在於 127.0.0.1 那在  Web.Config 一定會有一個連線字串長這樣

<connectionStrings>
    <add name=”MyDB”
      connectionString=”Data Source=127.0.0.1;Initial Catalog=MyReleaseDB;Integrated Security=True”/>
  </connectionStrings>

當然這樣的連線字串給客戶時是不會通的,以往都是用手動調整 Web.Config 給客戶,這種方式不但麻煩而且經常忘記,並且發佈給客戶的檔案應該都要給 Release 版這篇文章有提到為什麼該用 Release([筆記]編譯時遇到 無法載入 System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider 錯誤的解決方法) 這時候只需要開啟 Web.Release.config 調整如下

1
2
3
4
5
<connectionStrings>
      <addname="MyDB"
        connectionString="Data Source=demo.tc;Initial Catalog=MyReleaseDB;Integrated Security=True"
        xdt:Transform="SetAttributes"xdt:Locator="Match(name)"/>
    </connectionStrings>

這樣子再使用 Release 組件組態發行的時候就會自動更改 將 127.0.0.1 改成 demo.tc 了,其中的重點就在於 name 和
xdt:Locator=”Match(name)” 這兩段,因為我們今天要改的是連線字串所以就是包在 connectionStrings 標籤內 利用了 Match(name) 告訴轉換器 當發現 connectionStrings 內有 name=MyDB 的就會置換掉,算是很容易理解,如果有多個就寫多次就好,以下用經常性很多的 appSettings 來做示範

1
2
3
4
5
<appSettings>
    <addkey="emailAccount"value="service@com.tw"xdt:Transform="SetAttributes"xdt:Locator="Match(key)"/>
    <addkey="emailPassword"value="1234"xdt:Transform="SetAttributes"xdt:Locator="Match(key)"/>
    <addkey="systemFromEmail"value="service@com.tw"xdt:Transform="SetAttributes"xdt:Locator="Match(key)"/>
  </appSettings>

可以看到因為 appSettings 並不是用 name 而是用 key 所以 Match 就是使用Match(key) 而非 Match(name),利用以上的方法可以很快的置換開發機與正式機不同的設定,讓部屬的時候需要手動調整的部份降低到最少。


注意事項如果你是使用 ASP.NET MVC 你可能會發現在使用 Release 編譯並且有開編譯 View 時很容易發生

在應用程式層級之外使用註冊為 allowDefinition=’MachineToApplication’ 的區段發生錯誤。錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為應用程式。 這錯誤,這原因是因為殘留檔案的影響解決方法為在你的專案(方案)上使用清除專案(方案)後再重新編譯一次即可,當然你有更簡單的作法安裝 VSCommands 2010 這套件後方案總管上就會有掃把圖示可以按,按下去後你每次編譯的時候都會清除 obj 內的檔案

Reference from: http://demo.tc/Post/661

Categories: Others Tags:

Cache Manager 快取總管

March 9, 2011 Leave a comment

Cache Manager 快取總管-管理 Web 網站快取物件的好幫手

大家都知道在開發網頁的時候因為 Server 的數量遠不及 Client 所以經常會使用到 Cache 技巧,不管是 OutCache 或是 RunTime Cache 都是降低 Server 負載的好方式,但是你有沒有想過到底 Cache 放對東西了嗎?或是放了太多一樣的東西,如果快取用的不好不但沒有幫助到效能反而可能拖累整個 Server ,因此 demo 要推薦一個早在 2006 年就推出的好東西,它可以讓我們方便快速的看到快取的狀態和內容進而調整快取的數量與值。
// //

●首先就是到官網下載後參考到你的專案內(記得要選取複製到本機)


●然後開啟專案的 Web.Config 把 CacheManager 註冊進去

IIS 6 註冊法

1
2
<addverb="*"path="CacheManager.axd"
     type="AspAlliance.CacheManager.CacheManagerPageFactory,AspAlliance.CacheManager"/>


 

IIS 7 註冊法

1
<addname="CacheManager"verb="*"path="CacheManager.axd"type="AspAlliance.CacheManager.CacheManagerPageFactory,AspAlliance.CacheManager"/>


●這樣子就可以直接連到 http://localhost/CacheManager.axd 使用,首頁就長這樣

你可以在這頁看到伺服器還剩下多少記憶體和你已經使用了幾個快取物件(RunTime Cache)


●當你按下了【Clear Application Cache】就會將伺服器上所有的快取刪除(RunTime Cache)


●當您按下了【View Cache Entries】可以查看快取物件的型態,如果該物件是可以序列化還可以看到內容值


●最後一個選項是【Remove Page Output Cache】按下去後輸入網址就可以清除 Output Cache


注意事項看了以上的功能你一定也覺得這個 Cache Manager 相當實用,但你也可能發現了一件事情,任何人都可以進到這工具頁面,這是相當不安全的雖然他只能清快取,但如果開發人員不小心將敏感資訊存放在快取物件中那就問題大了,所以我們必須要增加一下它的安全性,官網有個最簡單也還滿有效的解決方案,那就是改檔名….你可以將預設檔名改掉這樣別人就不好猜,猜不到也就進不來了…..。

●當然你可以使用更正統更安全的作法設定location區塊,你可以限制有登入的才可以看

1
2
3
4
5
6
7
<locationpath="CacheManager.axd">
  <system.web>
    <authorization>
      <denyusers="?"/>
    </authorization>
   </system.web>
 </location>

●或是更進階一點設定只有最高管理者角色的使用者才可以看

1
2
3
4
5
6
7
8
<locationpath="CacheManager.axd">
    <system.web>
      <authorization>
        <allowroles="Admin"/>
        <denyusers="*"/>
      </authorization>
    </system.web>
  </location>

 

demo廢言快取雖然好用但是也要適量使用,不要一谷腦的全丟進去,不然就會發生下面這種情況…

Reference from:http://demo.tc/Post/663 

Categories: Others Tags:

Creating and Hosting Awesome Axure Libraries

February 10, 2011 Leave a comment

Library Screenshot
Want to make your own Axure libraries? This is a short how-to guide on getting the most out of it.

  1. Plan
    • Choose a central theme.
    • Make a list of widgets that will be included.
    • Determine a common style to use throughout the library. This may include color, grid, typography, interactivity, and copy.
  2. Create
    • Open Axure RP.
    • In the widgets pane on the left, click the “Wireframe” dropdown and choose “Create library…”
    • Save the new document with a short, clear name—this will be the name that shows up in the library droplist for everyone.
    • Create each widget just like you would create new pages in a normal prototype.
  3. Polish
    • Name everything that may be interactive. A dynamic panel for showing a calendar should be named something like “panel – calendar”. A submit button should be something like “button – submit”. This will help your users during annotation and spec generation.
    • Add Rollover, MouseDown, Selected, and Disabled states to interactive shapes like buttons. Right click the object > Edit Button Shape > Edit Rollover Style (etc).
    • Many widgets may contain more than one element. Group them together (ctrl + G) to ensure they don’t get separated when your users move them around.
    • Sort the widgets. This is difficult because you have to do it manually and there is no best sort order. Play around with sorting options, such as alphabetical vs. order or importance, to find what’s right for you. It’s worth the effort.
    • Add custom thumbnails. Another pain-in-the-butt task that will improve the professionalism of your library tenfold. Take your inner icon designer out for a spin and start producing 32 x 32 px thumbnails in .png format. Apply them to widgets by right clicking the Widget > “Widget Properties” > “Import Icon”. Make liberal use of screen grabs. Even your lamest effort at producing an icon will look better than the grainy compressed default that Axure spits out.
    • Add descriptions. I don’t always do this, but for complex widgets, it can be good to explain them a bit. Right click the Widget > “Widget Properties”. Put your description in the text area.
  4. Distribute
    • Hosting .rp / .rplib files is fraught with issues due to their resemblance to .zip files. There is one true method for hosting these things successfully (take my word for it): Put the .rp / .rplib file(s) in a folder, and zip the folder. This is the file you distribute.
  5. Announce

reference from:http://www.acleandesign.com/2010/04/creating-and-hosting-awesome-axure-libraries/

Categories: Others Tags:

Axure Better Defaults Library v2

February 10, 2011 1 comment

Reference from: http://www.acleandesign.com/2010/04/axure-better-defaults-library-v2/

This is version 2 of the Better Defaults library, expanded to sixty five (or so) interactive and cleanly styled widgets. Use it in place of the standard widget set.

Reasons to use these widgets include:

  • Consistent and improved styling.
  • Polished interactivity.
  • Standardized labeling.
  • Expanded set of shapes & controls.
  • Rollover, MouseDown, Selected, and Disabled styles for most controls.
  • Includes all defaults.

This is for version 5.5 and above. Put the extracted .rplib file in your “My Documents\My Axure RP Libraries\” folder (Windows) or your “Documents\Axure\Libraries” folder (Mac).

Preview |  Download

 

Categories: Others Tags:

自然人憑證介紹

November 24, 2009 Leave a comment

自然人憑證介紹

Categories: Others