自分で作ったり提供したりするものは、まず自分自身で使ってみろろということです。自分じゃ使わないものなら人はいくらでも無責任にも無思考にもなれる。そういう投げやりな「サービス」やら「プロダクツ」なんて、だれだってイヤだ。自分が作り手と同時に利用者の立場になれば、ちゃんと使えるレベルのものを提供しようとします。

2010年8月30日月曜日

WindowsとOfficeのバージョンと保守サポート期間

2010年8月26日木曜日

UpdatePanel使用コツ

①クライアントのjavascriptを実行する
   private void RunClientScript(string key, string content)
   {
     ScriptManager.RegisterClientScriptBlock(UpdatePanelGridView, typeof(UpdatePanel), key, content, true);
   }

②PageLoadイベントに非同期リクエストかどうかを判断する
  ScriptManager170.IsInAsyncPostBack

2010年8月20日金曜日

URLルート知識

URLルート追加:
routes.MapRoute(
    "Default",                                      // Route name
    "{controller}/{action}/{id}",                   // URL with parameters
    new { controller = "Home", action = "Index",    // Parameter defaults
          id = UrlParameter.Optional }
);

本来の書き方:
Route myRoute = new Route("{controller}/{action}/{id}", new MvcRouteHandler())
{
    Defaults = new RouteValueDictionary( new {
        controller = "Home", action = "Index", id = UrlParameter.Optional
    })
};
routes.Add("Default", myRoute);

2010年8月19日木曜日

lambda式サンプル

C#3.0からlambda式文法が提供されました、ここでlambda式使用方法を紹介します。

関数定義:
private int test01(int p1, Func<int, int> func1)
{
return func1(p1);
}
この関数の第二引数は一つのint引数とint戻り値の関数式を指定しています。

lambda文法使用例:
int temp = 0;
temp = test01(5, x => x * x); // 25
temp = test01(5, x => x + x); // 10
temp = test01(5, x => x - x); // 0

2010年8月18日水曜日

Ninject(IoC/DIコンテナ)

Don't call me, I will call you.

Ninject入門サンプル
一、ログ出力インターフェースを宣言する
  1. public interface ILogger
  2. {
  3.     void Write(string message);
  4. }
二、ログ出力2つのパターンを定義する
  1. public class FlatFileLogger : ILogger
  2. {
  3.     public void Write(string message)
  4.     {
  5.         Console.WriteLine(String.Format("Message:{0}", message));
  6.         Console.WriteLine("Target:FlatFile");
  7.     }
  8. }

  9. public class DatabaseLogger : ILogger
  10. {
  11.     public void Write(string message)
  12.     {
  13.         Console.WriteLine(String.Format("Message:{0}", message));
  14.         Console.WriteLine("Target:Database");
  15.     }
  16. }
三、NinjectModuleを通じて、DI(Dependency Injection)を実現する
  1. internal class MyModule : Ninject.Modules.NinjectModule
  2. {
  3.     public override void Load()
  4.     {
  5.         Bind<ILogger>().To<FlatFileLogger>();
  6.         Bind<ILogger>().To<DatabaseLogger>();
  7.     }
  8. }
四、利用方法
  1. private static IKernel kernel = new StandardKernel(new MyModule());
  2. static void Main(string[] args)
  3. {
  4.     ILogger logger = kernel.Get<ILogger>();
  5.     logger.Write("Bruce Say: Hello Ninject!");
  6.     Console.WriteLine("continues..");
  7.     Console.Read();
  8. }

2010年8月17日火曜日

Asp.Net MVC2必須技術のまとめ

Ninject
http://ninject.org/

WatiN
http://watin.sourceforge.net/

moq
http://code.google.com/p/moq/

オプション:(勉強したほうがいい)
SpecFlow
http://specflow.org/

2010年8月16日月曜日

iPhoneとiPadアプリ紹介サイト


http://apptrackr.org/

2010年8月11日水曜日

Celtics-UBuntu

urlエンコード(javascript)

function button1_onclick() {
    text2.value = escape(text1.value);
    text2.value = encodeURI(text1.value);
    text2.value = encodeURIComponent(text1.value);
}

function button2_onclick() {
    text3.value = unescape(text2.value);
    text3.value = decodeURI(text2.value);
    text3.value = decodeURIComponent(text2.value);
}

ホームページ