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

2011年1月29日土曜日

新しいドメインkomanew.blogspot.com

Koma新知識

http://komanew.blogspot.com

2010年11月24日水曜日

SqlEndia 2.6.1

データベース開発ツールSqlEndia 2.6.1テスト版ダウンロードURLを公開します。

http://www.sqlendia.com/download/sqlendia2.6.1.zip

対応内容:
①SqlServer2008対応
②バグ修正

2010年11月19日金曜日

c# string compareto

C#でストリング比較関数(CompareTo)実行結果をメモします。

string teststring = "20101115";
System.Diagnostics.Debug.WriteLine(teststring.CompareTo("20101114"));
System.Diagnostics.Debug.WriteLine(teststring.CompareTo("20101115"));
System.Diagnostics.Debug.WriteLine(teststring.CompareTo("20101116"));

実行結果:
1
0
-1

また
string teststring = "20101115";
System.Diagnostics.Debug.WriteLine("20101113".CompareTo(teststring));
System.Diagnostics.Debug.WriteLine("20101114".CompareTo(teststring));
System.Diagnostics.Debug.WriteLine("20101115".CompareTo(teststring));
System.Diagnostics.Debug.WriteLine("20101116".CompareTo(teststring));
System.Diagnostics.Debug.WriteLine("20101117".CompareTo(teststring));

実行結果:
-1
-1
0
1
1

2010年11月10日水曜日

asp.net mvc2 controller attributeサンプル

asp.net mvc2フレームワークのコントローラー属性を定義するサンプルです。

ShowMessageAttribute.cs
namespace MvcApplicationEmpty.Attributes
{
    public class ShowMessageAttribute : ActionFilterAttribute
    {
        public string Message { get; set; }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //base.OnActionExecuting(filterContext);
            filterContext.HttpContext.Response.Write("[OnActionExecuting " + Message + "]");
        }
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            //base.OnActionExecuted(filterContext);
            filterContext.HttpContext.Response.Write("[OnActionExecuted " + Message + "]");
        }
        public override void OnResultExecuting(ResultExecutingContext filterContext)
        {
            //base.OnResultExecuting(filterContext);
            filterContext.HttpContext.Response.Write("[OnResultExecuting " + Message + "]");
        }
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            //base.OnResultExecuted(filterContext);
            filterContext.HttpContext.Response.Write("[OnResultExecuted " + Message + "]");
        }
    }
}

asp.net mvc複数ボタンの処理

asp.net mvcフレームワークのformに複数のSubmitボタンを配置して、押したボタン情報のみサーバーに送信する処理を説明します。

①まずViewModelにCmdプロパティを定義する。
public string Cmd { get; set; }

②画面にSubmitボタンを配置する。
<button name="Cmd" value="btn1">確定1</button>
<button name="Cmd" value="btn2">確定2</button>

③コントローラーにCmd引数を判定して、ボタン処理を振り分ける。
[HttpPost]
public ViewResult DoLink2(GuestResponse pobjGuestResponse)
{
    switch (pobjGuestResponse.Cmd)
    {
        case "btn1":
            break;
        case "btn2":
            break;
    }
...
}

asp.net mvc2メモ

参照用ソースのメモです。
1、Controllersフォルダにコントローラーを作る
2、Viewsフォルダにコントローラーごとにフォルダを作って、下にコントローラーメッソド(Action)ごとにビューページを作る
3、Global.asax.csにデフォールトページ或はコントローラーを指定する

2010年11月9日火曜日

jQuery ajaxサンプル

jQuery ajax関数のサンプルをメモします。

ソース:
<script type="text/javascript">
    $(function () {
        $("#btn01").click(function () {
            $.ajax(
                {
                    async: false,
                    global: false,
                    ifModified:false,
                    url: "/txt/txt1.txt",
                    cache: false,
                    beforeSend: function () {
                        $("#div01").append("<hr/>");
                    },
                    dataFilter: function(data, type){
                        return "<b>" + data + "</b>";
                    },
                    success: function (msg, textStatus) {
                        $("#div01").append(msg + "<br/>");
                    },
                    error: function(xhrobj, status, errorEx){
                        $("#div01").append(status + "<br/>");
                    },
                    complete: function (xhrobj, textStatus) {
                        $("#div01").append(textStatus + "(complete)<hr/>");
                    }
                }
            );
        });

        $("#btn02").click(function () {
            $.ajax(
                {
                    type: "post",
                    url: "/Home/AjaxTest",
                    cache:false,
                    dataType: "text", // xml, html, script, json, jsonp, text
                    data:
                    { 
                        data: "あいうえお",
                        data1: ["aaa", "bbb"],
                    },
                    success: function (msg, textStatus) {
                        $("#div02").append("success:<br/>");
                        $("#div02").append(msg + "<br/>");
                        var obj = jQuery.parseJSON(msg);
                        $("#div02").append("obj.a=" + obj.a + ",obj.b=" + obj.b + "<br/>");
                    },
                }
            );
        });
    });
</script>

2010年11月8日月曜日

jQuery :parentフィルター

:parentはセレクター内容の親タグにマッチします。


文字1
文字2
文字3

jQuery :hasフィルター

:hasは引数で指定されたセレクターにマッチする少なくとも一つのタグを含む対象に絞り込みます。


文字1
文字2
文字3
文字4

jQuery :emptyフィルター

:emptyはサブ要素を持たない親タグを絞り込みます。


文字1
文字2
文字4

ホームページ