2012年10月10日水曜日

ie (ie9) でjavascriptが動かない

jqueryを使ってAjaxでフォームのオプションを絞り込むような処理を作成。
FFでは問題なかったがieではなぜか動かない。
コンソール(開発者ツール?)を表示させるとなぜか動く…
キャッシュとかが問題か?などとしばらく悩むも
console.log('foo');の記述がまずかったみたい。
ieだとコンソール開いてないとエラーになるのね…

(なぜか動くとか言ってる時点で気づくべきか)

しかしieは随分よくなったとは言えなんだかなぁー=3

2012年7月14日土曜日

NSNull って使えないかも

NSNull objecrtive-cのコレクションにはnilを突っ込めないので(番兵につかわれてる?)のでディクショナリーなんかで値がないことを表現したい場合はNSNullクラスのインスタンスを使うみたい。
ドキュメントにもそう書いてある。ちなみにシングルトンインスタンスのようだ。
こいつをif文で比較すると真になってしまう。ただのオブジェクトなので当然かも知れないが、期待としてはそうじゃないだろと・・・
 NSNull *nullObj = [NSNull null] //シングルトンインスタンスを取得する
if(nullObj){
     NSLog(@"残念...");
}else{
    NSLog(@"こっちでしょ");
}

>残念...

まあただのオブジェクトなんだからむしろこれが正しいのか。
適当にメソッド作って対応するしかないのかな。

- (BOOL)isNSNull:(id)obj{
    if([obj isEqual:[NSNull null]] || obj == nil){
        return YES;
    }else{
        return NO;
    }
}
そういえばDBNullってあったなあ。あれも比較が冗長だったけど似たようなもんか。

2012年3月30日金曜日

android暗号化メモ

データを暗号化する際に、エミュレータでうまくいっても実機だと
プロバイダーがなかったりしてうまく動作しないことがある。

とりあえず使えるプロバイダの確認

java.security.Security.getProviders()

で一覧を取得できる。
以下エミュレータで取得した結果

for(Provider each : java.security.Security.getProviders()){
    android.util.Log.d(tag, each.getName());
}

エミュレータ
  • AndroidOpenSSL
  • DRLCertFactory
  • BC
  • Crypto
  • HarmonyJSSE

手元にある 001HT
  • DRLCertFactory
  • Crypto
  • HarmonyJSSE
  • BC

機種に依存したくないならProviderをアプリに含めるしかなさそうだ。

ついでにエミュレータで各プロバイダのアルゴリズムを出力してみた。

ProviderName : AndroidOpenSSL
  • Service algorithm : SSL
  • Service algorithm : MD5
  • Service algorithm : SSLv3
  • Service algorithm : SHA-512
  • Service algorithm : Default
  • Service algorithm : SHA-256
  • Service algorithm : SHA-1
  • Service algorithm : TLS
  • Service algorithm : TLSv1
  • Service algorithm : SHA-384


ProviderName : DRLCertFactory

  • Service algorithm : X509


ProviderName : BC

  • Service algorithm : PBEWITHSHA256AND128BITAES-CBC-BC
  • Service algorithm : SHA-1
  • Service algorithm : SHA-512
  • Service algorithm : SHA-384
  • Service algorithm : DESEDEWRAP
  • Service algorithm : PBEWITHMD5AND256BITAES-CBC-OPENSSL
  • Service algorithm : RSA
  • Service algorithm : PBEWITHHMACSHA1
  • Service algorithm : PBEWITHMD5AND192BITAES-CBC-OPENSSL
  • Service algorithm : PBEWITHSHA1ANDDES
  • Service algorithm : PBEWITHMD5ANDDES
  • Service algorithm : DH
  • Service algorithm : ARC4
  • Service algorithm : PBEWITHSHAAND192BITAES-CBC-BC
  • Service algorithm : PKCS12PBE
  • Service algorithm : AES
  • Service algorithm : SHA-256
  • Service algorithm : PBEWITHHMACSHA1
  • Service algorithm : DH
  • Service algorithm : DSA
  • Service algorithm : BouncyCastle
  • Service algorithm : DESEDE
  • Service algorithm : DESEDE
  • Service algorithm : Collection
  • Service algorithm : HMACSHA512
  • Service algorithm : PBEWITHSHAAND2-KEYTRIPLEDES-CBC
  • Service algorithm : PKIX
  • Service algorithm : HMACSHA256
  • Service algorithm : AESWRAP
  • Service algorithm : PBEWITHMD5ANDRC2
  • Service algorithm : PKCS12
  • Service algorithm : HMACSHA384
  • Service algorithm : PBEWITHSHAAND40BITRC2-CBC
  • Service algorithm : NONEWITHDSA
  • Service algorithm : DES
  • Service algorithm : SHA1withDSA
  • Service algorithm : RC4
  • Service algorithm : PBEWITHSHAAND256BITAES-CBC-BC
  • Service algorithm : RSA
  • Service algorithm : PBEWITHSHAAND128BITRC4
  • Service algorithm : DH
  • Service algorithm : HMACSHA384
  • Service algorithm : PBEWITHSHAAND192BITAES-CBC-BC
  • Service algorithm : PBEWITHSHA1ANDRC2
  • Service algorithm : DSA
  • Service algorithm : PBEWITHSHA256AND192BITAES-CBC-BC
  • Service algorithm : DH
  • Service algorithm : PBEWITHSHAAND128BITRC2-CBC
  • Service algorithm : PBEWITHSHAAND3-KEYTRIPLEDES-CBC
  • Service algorithm : DESEDE
  • Service algorithm : PBEWITHMD5ANDRC2
  • Service algorithm : SHA256WithRSAEncryption
  • Service algorithm : PBEWITHMD5AND256BITAES-CBC-OPENSSL
  • Service algorithm : DSA
  • Service algorithm : BLOWFISH
  • Service algorithm : PBKDF2WithHmacSHA1
  • Service algorithm : SHA512WithRSAEncryption
  • Service algorithm : PBEWITHMD5AND128BITAES-CBC-OPENSSL
  • Service algorithm : SHA384WithRSAEncryption
  • Service algorithm : PBEWITHHMACSHA
  • Service algorithm : AES
  • Service algorithm : PKIX
  • Service algorithm : PBEWITHSHAAND40BITRC4
  • Service algorithm : PBEWITHSHAAND128BITAES-CBC-BC
  • Service algorithm : DES
  • Service algorithm : PBEWITHSHAANDTWOFISH-CBC
  • Service algorithm : HMACSHA512
  • Service algorithm : PBEWITHSHAAND40BITRC4
  • Service algorithm : HMACMD5
  • Service algorithm : HMACSHA1
  • Service algorithm : PBEWITHSHA256AND192BITAES-CBC-BC
  • Service algorithm : PBEWITHSHAAND3-KEYTRIPLEDES-CBC
  • Service algorithm : HMACSHA1
  • Service algorithm : PBEWITHMD5ANDDES
  • Service algorithm : DSA
  • Service algorithm : PBEWITHSHAANDTWOFISH-CBC
  • Service algorithm : DES
  • Service algorithm : PBEWITHSHAAND128BITRC2-CBC
  • Service algorithm : AES
  • Service algorithm : PBEWITHSHAAND40BITRC2-CBC
  • Service algorithm : PBEWITHSHA1ANDDES
  • Service algorithm : HMACMD5
  • Service algorithm : PBEWITHMD5AND128BITAES-CBC-OPENSSL
  • Service algorithm : PBEWITHSHA256AND128BITAES-CBC-BC
  • Service algorithm : X.509
  • Service algorithm : PBEWITHSHAAND256BITAES-CBC-BC
  • Service algorithm : DES
  • Service algorithm : DESEDE
  • Service algorithm : BLOWFISH
  • Service algorithm : MD5WithRSAEncryption
  • Service algorithm : HMACSHA256
  • Service algorithm : OAEP
  • Service algorithm : BKS
  • Service algorithm : PBEWITHSHAAND128BITRC4
  • Service algorithm : MD5
  • Service algorithm : PBEWITHSHAAND128BITAES-CBC-BC
  • Service algorithm : PBEWITHSHA256AND256BITAES-CBC-BC
  • Service algorithm : PBEWITHSHA1ANDRC2
  • Service algorithm : PBEWITHMD5AND192BITAES-CBC-OPENSSL
  • Service algorithm : RSA
  • Service algorithm : BLOWFISH
  • Service algorithm : PBEWITHSHAAND2-KEYTRIPLEDES-CBC
  • Service algorithm : SHA1WithRSAEncryption
  • Service algorithm : PBEWITHSHA256AND256BITAES-CBC-BC
  • Service algorithm : DH

ProviderName : Crypto

  • Service algorithm : SHA1withDSA
  • Service algorithm : DSA
  • Service algorithm : SHA-1
  • Service algorithm : SHA1PRNG


ProviderName : HarmonyJSSE

  • Service algorithm : TLS
  • Service algorithm : TLSv1
  • Service algorithm : SSLv3
  • Service algorithm : X509
  • Service algorithm : X509
  • Service algorithm : SSL

実機の方は割愛するが試したかったBlowfishがなかった。

2012年1月17日火曜日

android 開発環境の構築でエラー

エミュレーターを立ち上げたところこんなエラーが

invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe.
Hint: use '@foo' to launch a virtual device named 'foo'.
please use -help for more information

とりあえずぐぐる
一発でコチラに解決法が。
助かりました。

Eclipseの [ウィンドウ]=>[設定]=>[Android]
SDKロケーションを変更。

C:\Program Files\Android\android-sdk
 ↓
C:\PROGRA~1\Android\android-sdk


確かにショートファイル名とかあるね。使ったことなかった・・・
ちなみにコマンドプロンプトで dir /x でショートファイル名も参照できる。