Spiga

2009/09/12 巴拉卡單車行

上次約好要去騎巴拉卡公路,結果天公不作美,這次終於等到一個天氣晴朗的星期六,就坐火車轉捷運到紅樹林站,我們一行四個人,沒想到才騎沒多久,車友的前輪就中獎破胎了,還好有前輪快拆,很快就補好了 (我技術還不錯,呵呵),打氣就交給苦主來好了,喂 ~~~ 右邊那一位,別笑那麼開心,你也好不那裡去 (他後來下山時後輪爆胎了):
SANY0066##ReadMore##

這個並不是傳說中的 101 警察局:
SANYO DIGITAL CAMERA

中途休息一下:
SANY0070SANYO DIGITAL CAMERA

101 警察局到了,為什麼叫做 101 警察局呢,因為它位於 101 甲縣道的起點上咩,這裡車友爆多的,大家都在這裡補水休息,接下來就要一直爬坡上二子坪了。
SANYO DIGITAL CAMERA
SANY0074SANY0075

爬爬爬~~~~
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA

中途有間咖啡店,點了杯梅子綠茶,老闆人很好 (中間那一位),還給我的水袋加了兩大片冰塊,再裝滿水,我們在這裡休息了很久:
SANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA

于右任先生墓:
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA

大屯山自然公園:
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA

到了二子坪停車場後,就我和 watermelon 兩個人直接攻上大屯山助航站,其它兩位就在停車場等我們,這一路真是夭壽陡的,我只能一路用倒數第二擋,每小時 5 公里不到一路龜上去:
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANY0112SANYO DIGITAL CAMERA
SANY0115SANYO DIGITAL CAMERA

大屯山助航台到了,YA ~~~ 這裡可以看到台北市、淡水河、海、…如果天氣再好點,視野會更好。
SANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA

下山時經過小油坑:
SANYO DIGITAL CAMERA

本來一行四人要一起下山到文化大學附近去吃午餐,結果車友後輪爆胎,我從文化大學折回去找他 (累死我了),後輪內胎整個裂掉,又沒有快拆,所以也沒辦法給它換上新內胎,只好陪他慢慢走下山等公車,還好公車可以上他的小折;然後我再騎下山去文化大學和其他兩位會合,本來是要去吃牛肉拌麵的 (下次再來吃好了),結果太多人排隊,所以就隨便找一家簡餐吃。

今天真的有累到,比之前破百的行程要累多了,一路爬升 1000 多公尺果然很操,不過我們騎得還算快的,上山沿路都有超別人的車,高迴轉數果然有用,腿也不會太痠,不過高迴轉數也讓我的腳踝很酸,看來要多練練腳踝,讓腳踝強壯些。

軌跡圖:
軌跡圖

高度表:
高度表

速度表:
速度表

碼錶資訊:
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
SANYO DIGITAL CAMERASANYO DIGITAL CAMERA

  • 總時間: 7:30AM ~ 04:00PM
  • 總騎乘時間: 8 小時 30 分
  • 總騎乘距離: 68.3 公里
  • 最高時速: 61.7 公里/小時
  • 平均時速: 14.4 公里/小時
  • 2009/08/15 雙溪福隆東北角單車行

    今天早上太晚起床了,一直拖到 8:40AM 才出門,這次的行程是走汐平路去平溪、十分,之前已經騎車去過好幾次了 (2008/12/28 汐止-平溪 單車挑戰2009/04/28 汐平路-106縣道 單車行),不過這次要在十分這邊走台2丙線去雙溪、福隆,然後走北海岸回汐止,全程差不多是 100 公里,難得在十分車站剛好看到有火車,而且還兩列哩:
    SANY0025##ReadMore##

    也不知道為什麼,台2丙線竟然沒什麼車,連在隧道內也是一樣,這樣也好,騎起來也安心一點。
    SANY0028SANY0030

    在雙溪倒是有不少人租自行車來騎,沿途還有讓遊客休息的棚子,還可以蓋記念章呦,只是一路都沒有樹蔭,非常的熱。
    SANY0031
    SANY0035SANY0032
    SANY0037SANY0036

    到雙溪市區就隨便在 7-11 吃碗涼麵和飲料,也補充了水,就繼續往福隆前進,不過由於是中午時間,太陽實在是太毒了,中途只好找個路邊的涼亭小睡一下,恢復體力。

    SANY0041SANY0040

    在台2丙線的終點有一間加油站,問了一下加油站的員工東北角要往那一邊走,結果他說右邊,沒想到就跑去福隆海水浴場了,再走下去不就要去宜蘭了,然後再由北宜回汐止 ?! No! No! No! 今天時間不夠,改天吧。於是折返往鼻頭角前進。
    SANY0047
    SANY0044SANY0045
    SANY0042

    疑 ?! 這兩個人是怎麼跑到礁石上去釣魚的哩 ?!
    SANY0050
    SANY0049SANY0048  

    最後經由瑞芳回汐止,這條路之前 2009/04/18 無耳茶壺山單車行 有走過,只不過是反向走。

    軌跡圖:
    軌跡圖

    高度表:
    高度表

    速度表:
    速度表

    碼錶資訊:
    SANYO DIGITAL CAMERASANYO DIGITAL CAMERA
    SANYO DIGITAL CAMERASANYO DIGITAL CAMERA

  • 總時間: 8:40AM ~ 05:20PM
  • 總騎乘時間: 8 小時 40 分
  • 總騎乘距離: 98.11 公里
  • 最高時速: 52.6 公里/小時
  • 平均時速: 16.2 公里/小時
  • 如何加密字串

    聖哥寫了一組副程式,可以用來將字串加密後 (使用 3DES 加密法),再轉成 Base64 字串,很適合使用在 web.config 中儲存一些重要資料,例如連線字串。

    其中的 key 和 iv 兩個參數必須是 128bit 的資料,也就是長度是 16 的 byte 陣列。##ReadMore##

    using System.Security.Cryptography
    using System.Text

    public string EncryptString(string s, byte[] key, byte[] iv)
    {
    TripleDESCryptoServiceProvider provider =
    new TripleDESCryptoServiceProvider();
    CryptoAPITransform encryptor = provider.CreateEncryptor(key, iv);

    UTF8Encoding utf8 = new UTF8Encoding();
    byte[] source = utf8.GetBytes(s);
    byte[] target = encryptor.TransformFinalBlock(source, 0, source.Length);

    return Convert.ToBase64String(target);
    }

    public string DecryptString(string s, byte[] key, byte[] iv)
    {
    TripleDESCryptoServiceProvider provider =
    new TripleDESCryptoServiceProvider();
    CryptoAPITransform decryptor = provider.CreateDecryptor(key, iv);

    UTF8Encoding utf8 = new UTF8Encoding();
    byte[] source = Convert.FromBase64String(s);
    byte[] target = encryptor.TransformFinalBlock(source, 0, source.Length);

    return utf8.GetString(target);
    }

    如何讓 MOSS 支援 AJAX

    如果要讓 MOSS 支援 AJAX,首先必須先下載 ASP.NET 2.0 AJAX Extensions 1.0 (按 這裡 下載),然後在 MOSS 伺服器上安裝它,安裝完畢之後,接下來要修改 MOSS 網站的 web.config 檔,一般是位於 c:\inetpub\wwwroot\wss\VirtualDirectories\80 資料夾下,也就是當初在建立應用程式時所設定的路徑,如下圖最下面的路徑:
    ##ReadMore##

    1. 在 <configSections> 元素下加入 <sectionGroup> 子元素如下:

    <configSections>
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
              <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
              <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
              <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
            </sectionGroup>
          </sectionGroup>
        </sectionGroup>
    </configSections>

    2. 在 <system.web>/<pages> 元素下加入 <controls> 子元素如下:

    <pages>
          <controls>
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          </controls>
    </pages>

     

    3. 在 <compilation> 元素下加入 <assemblies> 子元素如下:

    <assemblies>
           <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </assemblies>

     

    4. 在 <httpHandlers> 區段最後面加入以下 handlers 的註冊:

    <httpHandlers>
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>

     

    5. 在 <httpModules> 區段中加入以下模組:

    <httpModules>
          <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </httpModules>

     

    6. 在 <SharePoint>/<SafeControls> 區段中加入以下安全控制項註冊:

    <SafeControls>
          <SafeControl Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" />
    </SafeControls>

     

    7. 在 web.config 最後面的 </configuration> 這一行之前加上:

    <system.web.extensions>
        <scripting>
          <webServices>
          <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
          <!--
            <authenticationService enabled="true" requireSSL = "true|false"/>
          -->
          <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. -->
          <!--
          <profileService enabled="true"
                          readAccessProperties="propertyname1,propertyname2"
                          writeAccessProperties="propertyname1,propertyname2" />
          -->
          </webServices>
          <!--
          <scriptResourceHandler enableCompression="true" enableCaching="true" />
          -->
        </scripting>
      </system.web.extensions>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
          <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </modules>
        <handlers>
          <remove name="WebServiceHandlerFactory-Integrated" />
          <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
               type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </handlers>
    </system.webServer>

     

    8. 在主版頁面中加入 ScriptManager 控制項,主版面頁檔位於 \\[你網站網址]\_catalogs\masterpage 資料夾之下,預設檔名是 default.master,在 <WebPartPages:SPWebPartManager> 控制項下一行加入 <asp:ScriptManager> 控制項如下:

    <WebPartPages:SPWebPartManager id="m" runat="Server"/>

    <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>

     

    9. 接下來你就可以在頁面中或 WebPart 中使用 UpdatePanel 這一類的 AJAX 控制項了。

     

    參考資料: Integrating ASP.NET AJAX with SharePoint