2009年1月29日

Regular Expressions

我把閱讀到有關 Regular Expressions 的格式,作個簡單的整理。
字元 (metacharacter)
符號說明範例對應
.任何字元...A6x
\d數字\d\d65
\w文字\w\w-\d\dCX-97
\s空格
^起始樣式^\w\d-\dA7-8
$結束樣式^\d\d-\d\d\d$34-486
量詞 (quantifier)
符號說明範例對應
*0或多次
+1或多次^\w+@\w+\.\w+dyson@hello.com
?0或1次(blue|red)?BallblueBall, redBall, Ball
{n}n次
{min,max}min至max次
()子集合
|

[reference]
regular expression syntax: http://www.regexlab.com/en/regref.htm

2009年1月27日

Silverlight iFrame

將Silverlight內嵌到使用者的網頁或部落格中,
並可以依照使用者的帳號,顯示相對應的資訊。
可以應用在動畫表情、寵物遊戲、寶寶照片..等等。

  • 提供 user 一組 <iframe> 的語法
    example:
    <iframe style="WIDTH: 400px; HEIGHT: 300px" src="http://dysonliu.blogspot.com/test/TestSilverlight2.aspx?account=Dy&password=1234" frameborder="0" scrolling="no">
    </iframe>
    

  • 建立一個網頁,包含frame,並設定method="post"
    example:
    <body>
    <form id="form1" runat="server" method="post">
    <div">
    <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
    </div>
    </form>
    </body>
    
    

  • 利用程式碼產生 Silverlight 物件,並代入參數 example:
    protected void Page_Load(object sender, EventArgs e)
    {
      Silverlight obj = new Silverlight();
      obj.ID = "MySilverlight";
    
      obj.AutoUpgrade = true;
      obj.Enabled = true;
      obj.HtmlAccess = HtmlAccess.SameDomain;
      obj.Visible = true;
    
      obj.Width = 400;
      obj.Height = 300;
      obj.Source = "~/ClientBin/SilverlightParameter.xap";
    
      string acc = Request.QueryString["account"];
      string pss = Request.QueryString["password"];
    
      obj.InitParameters = "account=" + acc + ", password=" + pss;
    
      form1.Controls.Add(obj);
    }
    
  • 在 silverlight 的程式中,可以透過 Application_Startup 取得參數 example:
    private void Application_Startup(object sender, StartupEventArgs e)
    {
      if (e.InitParams.ContainsKey("account") == true &&
                    e.InitParams.ContainsKey("password") == true)
      {
        string account = e.InitParams["account"];
        string password = e.InitParams["password"];
       ...
      }
    
      this.RootVisual = new Page();
    }
    

Deploying Vue & .NET with Google OAuth on GCP Cloud Run

Deploying Vue & .NET with Google OAuth on GCP Cloud Run Deploying Vue & .NET with Google OAuth on GCP Cloud Run...