Jan 13

Android アプリのStack Trace情報をサーバーに転送する方法

ライブラリーを紹介させて頂きます。
android-remote-stacktraceです。
  • アプリ設定
    • 上記サイトでtrace.jarをダウンロードして、ライブラリーパスに通す。
    • インターネットに接続する権限設定
      manifestに以下を追加し、インターネットに接続する権限を追加。

      <uses-permission android:name="android.permission.INTERNET">
    • 例外処理ハンドラーを登録
      Service, IntentService, ActivityクラスのonCreateメソッドをOverrideし、

      ExceptionHandler.register(this, “エラー情報を処理するphpファイルまでのURLパス");
      

      を追記する。Activityの数は多いので、すべてのActivityに書くのは大変かと思うので、
      BaseActivityクラスを継承するような設計にしておけば、BaseとなるクラスのonCreateメソッドに
      書くだけで済む。

  • サーバ設定
    • サイトに上がっているが、以下のphpファイルを設定
      <?php
      	// データが正しくない場合、エラーメッセージのページを見せる。
              if ( $_POST['stacktrace'] == "" || $_POST['package_version'] == "" || $_POST['package_name'] == "" ) {
                      die("This script is used to collect field test crash stacktraces. No personal information is transmitted, collected or stored.<br/>For more information, please contact <a href='mailto:support@nullwire.com'>email@domain.com</a>");
              }
              $random = rand(1000,9999);
              $version = $_POST['package_version'];
              $package = $_POST['package_name'];
              $handle = fopen($package."-trace-".$version."-".time()."-".$random, "w+");
              fwrite($handle, $_POST['stacktrace']);
              fclose($handle);
      
              // メールに例外情報を送信する場合、以下のメールに送信先メールアドレスと、送信元メールアドレスを修正し、コメントアウトを外す。
              //mail("mads.kristiansen@nullwire.com","IMPORTANT: Exception received (".$version.")",$_POST['stacktrace'], "from:bugs@nullwire.com");
      ?>
      

Sep 25

Triple boot Linux, Windows, Mac OSX on Mac

  • Prerequisite.
      Installed Windows using Bootcamp in 2nd partition
  1. Add 2 FAT partition for linux, swap to macintosh HD on DiskUtility.
  2. Install linux to linux partion and bootloader to there just installed linux.
  3. To boot linux, Recommend to install rEFInd. (rEFIt was stopped developing.)
    then reboot, you can select os.
  4. Try to boot windows, maybe you couldn’t boot it.
    to solve its problem, follow the belowing process.
  5. solution
        refered site : https://discussions.apple.com/thread/4144252?start=210&tstart=0

    Takatoshis-MacBook-Pro:~ nao0811ta$ sudo gpt -r -vv show disk0
    gpt show: disk0: mediasize=750156374016; sectorsize=512; blocks=1465149168
    gpt show: disk0: PMBR at sector 0
    gpt show: disk0: Pri GPT at sector 1
    gpt show: disk0: Sec GPT at sector 1465149167
    start size index contents
    0 1 PMBR
    1 1 Pri GPT header
    2 32 Pri GPT table
    34 6
    40 409600 1 GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B
    409640 876809040 2 GPT part – 48465300-0000-11AA-AA11-00306543ECAC
    877218680 1269536 3 GPT part – 426F6F74-0000-11AA-AA11-00306543ECAC
    878488216 1384
    878489600 292966400 4 GPT part – C12A7328-F81F-11D2-BA4B-00A0C93EC93B
    1171456000 2099200 5 GPT part – 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
    1173555200 291592192 6 GPT part – EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
    1465147392 1743
    1465149135 32 Sec GPT table
    1465149167 1 Sec GPT header

    Takatoshis-MacBook-Pro:~ nao0811ta$ sudo fdisk /dev/disk0
    Disk: /dev/disk0 geometry: 91201/255/63 [1465149168 sectors]
    Signature: 0xAA55
    Starting Ending
    #: id cyl hd sec – cyl hd sec [ start – size]
    ————————————————————————
    1: EE 0 0 1 – 1023 254 63 [ 1 – 1465149167]
    2: 00 0 0 0 – 0 0 0 [ 0 – 0] unused
    3: 00 0 0 0 – 0 0 0 [ 0 – 0] unused
    4: 00 0 0 0 – 0 0 0 [ 0 – 0] unused

    Takatoshis-MacBook-Pro:~ nao0811ta$ diskutil list
    /dev/disk0
    #: TYPE NAME SIZE IDENTIFIER
    0: GUID_partition_scheme *750.2 GB disk0
    1: EFI 209.7 MB disk0s1
    2: Apple_HFS Macintosh HD 448.9 GB disk0s2
    3: Apple_Boot Recovery HD 650.0 MB disk0s3
    4: EFI 150.0 GB disk0s4
    5: Linux Swap 1.1 GB disk0s5
    6: Microsoft Basic Data BOOTCAMP 149.3 GB disk0s6
    /dev/disk1
    #: TYPE NAME SIZE IDENTIFIER
    0: Apple_partition_scheme *21.0 MB disk1
    1: Apple_partition_map 32.3 KB disk1s1
    2: Apple_HFS rEFIt 20.9 MB disk1s2
    [/code]

    Takatoshis-MacBook-Pro:~ nao0811ta$ sudo gdisk /dev/disk0
    Password:
    GPT fdisk (gdisk) version 0.8.7

    Warning: Devices opened with shared lock will not have their
    partition table automatically reloaded!
    Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present

    Found valid GPT with protective MBR; using GPT.

    Command (? for help): ?
    b back up GPT data to a file
    c change a partition’s name
    d delete a partition
    i show detailed information on a partition
    l list known partition types
    n add a new partition
    o create a new empty GUID partition table (GPT)
    p print the partition table
    q quit without saving changes
    r recovery and transformation options (experts only)
    s sort partitions
    t change a partition’s type code
    v verify disk
    w write table to disk and exit
    x extra functionality (experts only)
    ? print this menu

    Command (? for help): p
    Disk /dev/disk0: 1465149168 sectors, 698.6 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 00003927-6A28-0000-B672-000087240000
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 1465149134
    Partitions will be aligned on 8-sector boundaries
    Total free space is 3133 sectors (1.5 MiB)

    Number Start (sector) End (sector) Size Code Name
    1 40 409639 200.0 MiB EF00 EFI system partition
    2 409640 877218679 418.1 GiB AF00 Customer
    3 877218680 878488215 619.9 MiB AB00 Recovery HD
    4 878489600 1171455999 139.7 GiB EF00 Kali Linux
    5 1171456000 1173555199 1.0 GiB 8200
    6 1173555200 1465147391 139.0 GiB 0700 BOOTCAMP

    Command (? for help): r

    Recovery/transformation command (? for help): h

    WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
    just hit the Enter key at the below prompt and your MBR partition table will
    be untouched.

    Type from one to three GPT partition numbers, separated by spaces, to be
    added to the hybrid MBR, in sequence: 6
    Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y

    Creating entry for GPT partition #6 (MBR partition #2)
    Enter an MBR hex code (default 07):
    Set the bootable flag? (Y/N): y

    Unused partition space(s) found. Use one to protect more partitions? (Y/N): n

    Recovery/transformation command (? for help): o

    Disk size is 1465149168 sectors (698.6 GiB)
    MBR disk identifier: 0x00006301
    MBR partitions:

    Number Boot Start Sector End Sector Status Code
    1 1 1173555199 primary 0xEE
    2 * 1173555200 1465147391 primary 0x07

    Recovery/transformation command (? for help): p
    Disk /dev/disk0: 1465149168 sectors, 698.6 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 00003927-6A28-0000-B672-000087240000
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 1465149134
    Partitions will be aligned on 8-sector boundaries
    Total free space is 3133 sectors (1.5 MiB)

    Number Start (sector) End (sector) Size Code Name
    1 40 409639 200.0 MiB EF00 EFI system partition
    2 409640 877218679 418.1 GiB AF00 Customer
    3 877218680 878488215 619.9 MiB AB00 Recovery HD
    4 878489600 1171455999 139.7 GiB EF00 Kali Linux
    5 1171456000 1173555199 1.0 GiB 8200
    6 1173555200 1465147391 139.0 GiB 0700 BOOTCAMP

    Recovery/transformation command (? for help): w

    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!

    Do you want to proceed? (Y/N): y
    OK; writing new GUID partition table (GPT) to /dev/disk0.
    Warning: Devices opened with shared lock will not have their
    partition table automatically reloaded!
    Warning: The kernel may continue to use old or deleted partitions.
    You should reboot or remove the drive.
    The operation has completed successfully

Aug 23

How to use git for Windows using sourcetree

  1. Install Git for Windows
    •   Go to msysgit WebSite : http://code.google.com/p/msysgit/
    •   Download lastest version and Install
      Caution : lastest version is 1.8.3 now. That is why previous version has bugs when you push your branch.
  2. Install Git Client
    • Go to SourceTree WebSite : http://www.sourcetreeapp.com/
    • Download lastest version and Install
    • Due to the license is free, Recommend you to register.
    • Set Proxy
      • Options in source tree just installe
      • Move to Network Tab
      • Click “Use custom proxy settings” and set to what you want
      • Click “Proxy server requires username and password”
          Warning : username is not just username of proxy.. you should enter username as domain\username.
      • Click “Add proxy server configuration to Git/Mercurial
      • Disable SSL certification validation for WebSite using self-signed certification
      • Move to Git Tab
      • Click “Disable SSL certification validation”
    • Change git to system git(custom installed git)
      • Still on Git Tab, click “Use System Git” Button
  3. Generate private key and public key for accessing your gitlab project to sourcetree
    • Create Private key and Public Key
      • Start up sourcetree
      • Choose Tools/Create or Import SSH Keys  from the menu.
      • Click “Generate” and wiggle the mouse as requested on screen
      • Enter and confirm a key passphrase  (this will be used each time you want to commit, etc)
      • Click “Save private key” and save it to your folder which you want to save it and save with filename.ppk you want
      • Click “Save public key” and save it to the same folder above, so save it again as filename you want as it doesn’t have an extension
      • Select the entire public key that’s been generated in the text box at the top  and copy it to the clipboard!
      • Close the “Generate” dialog box altogether.
  4. Add the private key to source tree
    • Go to your Windows System Tray at right bottom.
      Whenever you have Sourcetree running there will be an app running called “Pageant”
      which is the PuTTY authentication agent ? it’s a blue PC with a hat icon
    • Caution : When you can find Pageant, You should go to Tools/Option in SourceTree,
      and Change SSH Client to Putty/Plink and Click “Automatically start SSH agent when SourceTree opens”.
      and then restart sourcetree.
    • Click “Add Key”
    • Browse to the private key file ( set above as filename.ppk) folder. And choose the .ppk file and “Open” it
    • Type in your passphrase what you entered when you create the private key.
    • Close this dialog box.
    • Go to Tools / Options
    • Stay on the General tab. Click the “…” button next to the SSH Key
    • Browse to the folder( where private key is ), and choose the .ppk file again.
    • Close the options dialog box.
  5. Add above public key saved into clipboard to Gitlab
    • Log in to Gitlab site
    • Click Image Button meaning My Profile at right top of the page.
    • Click “SSH keys”
    • Click “Add New”
    • Paste in the clipboard what keep public key  to “Key” field and fill title what it best express into “Title” field
    • Click “Save”

     

  6. Create Session for passing Proxy using ssh.
    • Download the full PuTTY.exe client from http://www.putty.org
    • Launch it
    • Type an session name under ‘Saved Sessions’
    • Go to Connection > Proxy
    • Fill in the proxy details
    • Go back to Session
    • Complete the host name above before saving
    • Click “Save”

     

  7. Clone Repo
    • Click “Clone/New” Image button in sourcetree
    • Move to “Clone Repository” Tab
    • Go to Project Home on Gitlab
    • Click “SSH” button and copy url next to the button.
    • Back to SourceTree and paste it to “Source Path/URL” field.
    • Replace its hostname with putty session name you created above.
    • Click “Destination Path” , then source path will be starting to detect repository
    • If Repository Type detected, Choose “Destination Path”
    • Finally,  Click “Clone” Button.

 

  • TroubleShootings
    • Tip: If Repository couldn’t detect, maybe private key is not proper. check out gitlab and sourcetree settings .
      If Error appeared like that
      fatal: Could not read from remote repository.
      Please make sure you have the correct access rights and the repository exists.
      , the causes are that key setting is not proper or proxy things.
    • In case of a cause like that
      Host does not existfatal: Could not read from remote repository.
      Please make sure you have the correct access rights
      and the repository exists.
      , that is why host was not resolved if your proxy blocked.

Dec 06

Started by publishing my homepage to open..

Let me start with enthusiasm this time is really going to open a website.
, By saying,
I aspire to be good to go pass the information everyone, and I will be felt very happy to see you come often.

この度はホームページを本気でオープンにして行くと言う意気込みで始めさせていただきました。
、と言う事で、
皆さんに良い情報を渡して行ける事を志して行きますので、度々見に来ていただけると嬉しく感じます。

이번기회에 홈페이지를 제대로 오픈해 가자는 마음가짐으로 시작하게 되었습니다…
, 그런 것으로..
모두에게 좋은 정보를 드려갈수 있도록 힘을 쓸 예정이니, 가끔이라도 찾아와 봐주시기를 하는 바램입니다.

Nov 28

Be available from external of receiving e-mail on Amazon EC2 with Amazon Linux


* Set hostname

1. echo > /etc/hostname
2.hostname -F /etc/hostname
3.service network restart

* Set sendmail to be available from external area for receiving mail

1. vi /etc/mail/sendmail.mc

Before
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl

After ( Comment out )
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl

2. m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
3. service sendmail restart


Older posts «