import socket,struct in_cidr = lambda ip, network, cidr: struct.unpack("!L", socket.inet_aton(ip))[0] & ~((1 << (32 - cidr)) - 1) == struct.unpack("!L", socket.inet_aton(network))[0]
月別アーカイブ: 2013年4月
ELBに登録したSSL証明書を削除する
aws iam delete-server-certificate --server-certificate-name hogehoge
iTunes Connectで出力されるCrash Reportsを読む
■Crash Reportsの取得
iTunes Connect > Manage Your Apps > Current Version > View Details > Crash Reportsからcrashファイルをダウンロードして解凍、クラッシュ箇所を特定する。
■バイナリのビルド
以下の状態でビルドしたバイナリが必要である。
- Build Settings の Strip Debug Symbols During CopyがNo
- Build Settings の Strip Linked ProductがNo
但し、この状態でビルドすると30~50%ファイルサイズが大きくなるのでリリースビルドではNoにしておくべきである。
unzip hoge.ipa cd Payload xcrun atos -arch armv7 -o hoge.app/hoge 0x000ac264
以下のように出力される。
+[TAGResourceUtil expandResource:] (in hoge) + 586
Build Settingsを変更していないと以下のようになる。
___lldb_unnamed_function3890$$hoge (in hoge) + 586
オーガナイザ
ビルド毎に設定変更しバイナリを保存しておくのは非効率である。Window>Organizer>ArchivesでSubmittedのバイナリを右クリックするとfinderでxcarchiveが取得できるのでエラー原因の追求にはこれを使う。
xcrun atos -arch armv7 -o hoge.app.dSYM/Contents/Resources/DWARF/hoge 0x000ac264
参考
Android用にmozcをUbuntuでビルドする
Google日本語入力Android版がオープンソースになったという事で早速ビルドしてみる。
■準備
EC2でUbuntu 12.04を使用。
sudo apt-get update sudo apt-get install g++ python subversion ibus make libibus-1.0-dev libzinnia-dev unzip ant qt4-dev-tools libqt4-core libqtgui4 git
■JDK
scp -i hogehoge.pem -r ~/Downloads/jdk-6u41-linux-x64.bin user@host:/home/user/jdk1.6.0_41 chmod 0700 jdk-6u41-linux-x64.bin ./jdk-6u41-linux-x64.bin PATH=$PATH:$HOME/jdk1.6.0_41/bin JAVA_HOME=$HOME/jdk1.6.0_41 export JAVA_HOME
■SDK
cd ~ wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz tar zxvf android-sdk_r21.1-linux.tgz export PATH=/home/ubuntu/android-sdk-linux/tools:"$PATH" cd ~/android-sdk-linux/platforms/ wget http://dl.google.com/android/repository/android-17_r01.zip unzip android-17_r01.zip mv android-4.2 android-17 wget http://dl.google.com/android/repository/android-2.2_r03-linux.zip unzip android-2.2_r03-linux.zip mv android-2.2_r03-linux android-8
■NDK
cd ~ wget http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2 tar -jvxf android-ndk-r8e-linux-x86_64.tar.bz2 export PATH=/home/ubuntu/android-ndk-r8e:"$PATH"
■mozc
cd ~/ svn co http://src.chromium.org/svn/trunk/tools/depot_tools export PATH="$PATH":`pwd`/depot_tools mkdir -p ~/src/mozc cd ~/src/mozc gclient config http://mozc.googlecode.com/svn/trunk/src gclient sync
ちなみにリビジョンを指定するには以下のようにする。
gclient sync --revision r178
mac
macでgclient syncを実行すると以下のようなエラーが出て完了できない。
Server certificate verification failed: issuer is not trusted (https://zinnia.svn.sourceforge.net)
以下のコマンドで事前に取り込んでおく。
svn ls https://src.chromium.org svn ls https://zinnia.svn.sourceforge.net
cd ~/src/mozc/src ./build_mozc.py gyp --target_platform=Android --android_sdk_home=/home/ubuntu/android-sdk-linux ./build_mozc.py build_tools -c Release android update project -s -p android -t android-8 python build_mozc.py build android/android.gyp:apk -c Release_Android
x86
./build_mozc.py gyp --target_platform=Android --android_sdk_home=/home/ubuntu/android-sdk-linux --android_arch_abi=x86
ちなみにcleanは以下のコマンドで行う。
./build_mozc.py clean
リリースビルドしようとするとPlatform toolsが無いと言われて怒られる。
BUILD FAILED /home/ubuntu/src/mozc/src/android/build.xml:86: The following error occurred while executing this line: /home/ubuntu/android-sdk-linux/tools/ant/build.xml:401: SDK Platform Tools component is missing. Please install it with the SDK Manager (tools/android)
Ubuntuマシンがローカルに欲しくなる。この状態で既に共有ライブラリなどは生成されているのでローカルにダウンロードしeclipseでビルドできる。
参考
RDSでインスタンスがブロックされMySQLに接続できなくなる
RDSを使っているとMulti-AZ DeploymentがYesになっている場合でも、以下のようにMySQLに接続できない時間が存在する。
Database connection "SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'endpoint.zone.amazonaws.com' " is missing, or could not be created.
ユーザーのアクセスごとにconnectが発生するようなシステムの場合、上述の接続できない時間の間に多数のユーザーがアクセスし、クライアントが接続エラーを繰り返す場合がある。その場合、以下のエラーが発生する。
Database connection "SQLSTATE[HY000] [1129] Host 'instance.zone.compute.internal' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'" is missing, or could not be created.
■上限値を増やす
max_connect_errorsを変更することで接続エラーの上限値を変更できる。
■ブロックを解除する
mysqladmin -h endpoint.zone.amazonaws.com -u user --password=password flush-hosts