STONEDSOUL

I wish I could give you meaningful additions

X04HT (Touch Diamond) のカスタマイズ

今になって 705NK から X04HT に機種変更した。もっさりしてるのと電池が持たないのは覚悟の上で、見た目と大きさ、画面の解像度、ホーム画面の見た目で決めた。docomo のやつにしなかったのは、i-mode のメールアドレスが取れないのと、携帯用のサイトが見れないらしいから。ポケットの中でごろごろしないのがいい。

インストールしたソフト

その他の設定

.NET Compact Frameworkのインストール

.NET Compact Framework 2.0をMac OS Xを母艦に導入する を参考に、以下の手順でインストールした。

  1. The Unarchiverで msi を解凍する。
  2. その中にある cfflies.cab を The Unarchiver で解凍する。
  3. その中にある F_.wm.armv4i.cab.B9F092F9_68DA_4CEB_BB8B_5BC56F898FEA を NETCFv35.wm.armv4i.cab にリネーム。
  4. X04HT に移して cab を実行。

JavaScript のちょっとした関数 (メモ)

あると便利かなあと思ったやつをネットで検索して自分向けにちょっと変えた。

URL のパラメータを取得(してオブジェクトに格納)

URL をパラメータで渡せるようにした(参照元)。

/**
 * parse query string for given URL or current location
 * @see    http://snipplr.com/view/15638/query-string-parsing-in-javascript/
 * @param  {string} URL
 * @return {object} Parameters (key-value)
 */
var parseQueryString = function(sUrl){
    var oParams = {},
        sQuery  = sUrl ? sUrl.split("?")[1] : window.location.search.substring(1);

    if (sQuery) {
        sQuery.replace(/([^?=&]+)(=([^&]*))?/g,
            function( $0, $1, $2, $3 ){
                oParams[ $1 ] = $3;
            }
        );
    }

    return oParams;
};

マルチバイト文字を 2 byte と数えてカットする SubStr みたいな関数

参照元は String オブジェクトを拡張してたのを ただの関数にした。

/**
 * return true if given character is multibyte. if the given argument
 * is more than one character, it uses the first character of the string
 * @see    http://oshiete1.watch.impress.co.jp/qa5076682.html
 * @param  {string}  Char that can be get by String.charAt()
 * @return {boolean} true if it's multibyte
 */
var isMultiByte = function(sChar){
    var sCharCode = sChar.charCodeAt(0);
    // Range of single byte chars
    // Unicode : 0x0 〜 0x80, 0xf8f0, 0xff61 〜 0xff9f, 0xf8f1 〜 0xf8f3
    if ( (sCharCode >= 0x0 && sCharCode <= 0x80)
         || (sCharCode == 0xf8f0) 
         || (sCharCode >= 0xff61 && sCharCode <= 0xff9f) 
         || (sCharCode >= 0xf8f1 && sCharCode <= 0xf8f3) ) {
        return false;
    } else {
        return true;
    }
};

/**
 * custom substr function that counts multi-byte character as 2 bytes.
 * @require  isMultiByte()
 * @see    http://oshiete1.watch.impress.co.jp/qa5076682.html
 * @param  {string} String to be extracted
 * @param  {number} Index where to start the extraction
 * @param  {number} Length (optional) number of characters to extract
 * @return {string} Extracted text
 */
var doubleByteSubStr = function(sString, nIndex, nLength){

    // find start index by byte
    for (var i=0, len=0; len < nIndex; i++) {
        len = isMultiByte(sString.charAt(i)) ? len+2 : len+1;
    }
    var nIndexBytes = i;

    // find length for substr by byte
    len = 0;
    while(nLength > len) {
        len = isMultiByte(sString.charAt(i)) ? len+2 : len+1;
        i++;
    }

    var nLengthBytes = i - nIndexBytes,
        sExtracted   = sString.substr(nIndexBytes, nLengthBytes);

    return sExtracted;
};

ToDo List Update

ToDo List を更新した。

  • 簡単なデータの Import/Export 機能を付けた
  • データ内のプロパティ名に typo があったので修正した (udpated -> updated)

もし以前に ToDo List にデータを入れていたら、更新日がおかしなプロパティ名で保存されていると思う。 これによって変な動きをすることがあるかもしれないので、その場合は一度 Export してデータを修正して、 Import (1つ目のオプションを選択)したら直ると思う。

Import の 1 つ目のオプションは、ブラウザに保存されてるデータを削除してから、データを読み込む。 2 つ目のオプションは、同じ ID の ToDo があった場合は、更新日の新しい方で上書きする。


I updated ToDo List application.

  • Added simple Import/Export feature
  • Fix typo (udpated -> updated) in property name of task data

If you already have task data, it must contain wrong property name, it might cause of some strange behaviors. You might want to export your data and correct wrong property “udpated” to “updated”, and then import with the first option - replace data.

The second option (merge) overwrite tasks in the same id by the latest updated date.

Page 1 of 48

powered by Tumblr