2017年7月17日月曜日

[Ruby] first monkey patch(Mechanize::Form::SelectList )

This is my first monkey patch(for Mechanize::Form::SelectList)

This monkey patch is even if the SelectList is not multiple, we can clear selectitems by select_none(original code was set first.value when select_none).

class Mechanize::Form::SelectList < Mechanize::Form::MultiSelectList
  def value
    value = super
    if value.length > 0
      value.last
    elsif @options.length > 0
      # @options.first.value
      nil
    else
      nil
    end
  end
end

2017年4月13日木曜日

potatotips #39 (iOS/Android開発Tips共有会)2017年4月13日に参加レポート

potatotips #39 (iOS/Android開発Tips共有会)2017年4月13日に参加してきました。
Android ブログ枠で参加しましたので、レポートします。

会場の「株式会社サイバーエージェント」は部屋が横長でちょっと話しにくそうでした。

https://potatotips.connpass.com/event/51176/

プレゼンテーションが公開されたら適宜リンクしていきます。

2. すたーほしさん:「iOS が fastlane なら Android も fastlane に乗って

みては?」



 - iOSで継続的デリバリー --> fastlaneを使う
   - 人間がやっていたことを自動化できる。
 - gradleでできることは、fastlaneでできる
 - fastlaneはGoogleの仲間に入った
 - fastlaneは、lane で対応している。
    - 雰囲気はiOSと同じ感じで対応できる。
 - fastlaneのgradleに比較したメリット
    - iOSと同じ感じでlaneを作れる。
    - ...
 - fastlaneのデメリット
    - rubyなども必要

  - fastlaneの設定例も公開しているので参照してみてください(Android/iOS)

https://github.com/starhoshi/fastlane-example

4. しゃのんさん「Android Javaの既存プロダクトをKotlinで書き換えている話」

- Android JavaアプリをKotlin x DataBindingに移行中

- 今までのアプリの状況
  - WebView版リリース
  - Native Appは7割完成しかし古いlibraryなど使う
  - この機会にKotlinに行こう

- Binding
  - ButterKnife6を利用していた
  -  Butterknife8にしたけどいまいち

- 攻めの構成(Kotlin x Databindで行けた理由
  - まだリリースしていないプロダクトだったので心の余裕あり
  - ペアcodingなどを導入

- 現状
  - 7割方Kotlin移行済み


6. さとしゅんさん「AutoDisposeとRxLifeCycleの話」

- RxLifeCycleとは
  - 非同期処理に対してdisposeをすればキャンセルできる。
  - 課題、ストリーム定義とストリームキャンセル部分が**離れている**
  - composeでPAUSE時にどうするこうすると、Observable定義時にキャンセルをかける

- RxLifecycleは、takeUntilオペレータに依存している
  - そのためdisposableと違う挙動になる。
  - Single, Completable時にonErrorが呼ばれる。

- AutoDispose
  - RxLifecycleの困った点を解決
  - Disposeと同じ挙動になる[OK]
  - .to(new Observable....)
  - AutoDisposeの欠点
    - toオペレータはストリームチェインを破壊するので最後に各必要がある。

8. いまけいさん「Sending Simple Data to Other Apps」

- グリッドでのアプリリストの出し方。
  - 普通に作るとListになる。
  - Intent.createChooser(sendIntent,....)とする
- 使い分け方
  - Listの方法
    - 任意のアクションを別のアプリで行いたい
    - コンテンツを別のアプリで開きたい
  - Grid
    - 現在見ているコンテンツを共有したい

10. きーすよこまさん「What’s new in Android O WindowManager」

- WindowManagerでいっぱいdeprecated APIとなっている。
  - DroidKaigi2017で説明した部分がのきなみdeprecated
- Application Overlayが追加された(TYPE_APPLICATION_OVERLAY"
- 整理された感じ

関連書籍: Colorful Android

12. こばけいさん「俺たちが欲しかった下タブはコレジャナイ」

- 下タブ
  - サポートライブラリーの対応はいまいち
    - タブ6枚以上でクラッシュなどなど
  - 3rd party
    - Matrial Guideline準拠
    - タイトル常に表示可能
    - などなど使いやすい

    - BottomBar
      - GOOD
         - 実績多数
         - セットアップがXML
         - Tablet
      - BAD
         - FAB連携ない
         - バッジが数字しかない。

    - ahbottomnavigation
      - GOOD
         -FAB対応、バッジ文字列対応
      - BAD
         - XML未対応など..

   - BottomNavigation
      - GOOD
         - FAB対応
         - バッジ対応
      - BAD
         - XML未対応など..

  - お勧めは?
      - FABを使って、タブレット非対応
        - ahbottomnavigation
     -  それ以外BottomBar

     - SupportLibraryは使う意味ない...


14. まぎーぷーさん「Autofill Framework」

- Android Oから入ったAutofill Framework
- ユーザーさんは面倒な作業やタイプミスが防げる
- Android Oに最適化されます。
- Mobile側に設定が必要
  - Settings -> Apps & Notification....

- TextViewは特になにもしなくてもOK
- CustomView/GLSurfaceViewなど
  - 面倒な対応必要

- AutoFillService
  - 認証情報を提供する
  - 1 Password

- FillResponse
  - アプリ側に返ってくる情報
    ...
  - onProvideAutoFillStructure
  - onProvideAutoFillVirtualStructure
     などで、テキストフォームがある情報をAutoFillServiceに通知

  - エミュレータでもうまく動かない
    - エミュレータのバグがまだあるらしい

2017年4月9日日曜日

[FreeBSD] how to install eMMC from SD-Card

I wrote boot image after boot from SD-Card.

# dd if=FreeBSD-12.0-CURRENT-arm-armv6-BEAGLEBONE-20170323-r315864.img of=/dev/mmcsd1 bs=10240 conv=sync

related infomation

https://wiki.freebsd.org/FreeBSD/arm/BeagleBoneBlack

currently below messages were outputed at u-boot. Unfortunately I do not know how to fix this issue. But after some seconds(about 5-10s), it will boot automatically.

Card did not respond to voltage select!

2017年2月28日火曜日

[DMM英会話]Top 10 Teacher(Feb/2017)


Rank(Jan Rank). Name, Techer ID, Score, Number of Votes
Teacher URL

Male

1(→1). Chriss,1077, 5.0, 2126
http://eikaiwa.dmm.com/teacher/index/1077/
2(↑5). Stevan K,11105, 5.0, 1719
http://eikaiwa.dmm.com/teacher/index/11105/
3(↑4). Silva,6221, 5.0, 1634
http://eikaiwa.dmm.com/teacher/index/6221/
4(↓3). Erno,1860, 5.0, 1596
http://eikaiwa.dmm.com/teacher/index/1860/
5(↑6). Richie,2581, 5.0, 1462
http://eikaiwa.dmm.com/teacher/index/2581/
6(↑↑). Mahir,2558, 5.0, 1437
http://eikaiwa.dmm.com/teacher/index/2558/
7(→7). Tweety,4320, 5.0, 1398
http://eikaiwa.dmm.com/teacher/index/4320/
8(→8). Rade,4208, 5.0, 1393
http://eikaiwa.dmm.com/teacher/index/4208/
9(↑10). Jaidev,8110, 5.0, 1337
http://eikaiwa.dmm.com/teacher/index/8110/
10(↑↑). . Nick D,4075, 5.0, 1302
http://eikaiwa.dmm.com/teacher/index/4075/

Female and only Philipino
1(→1). Lotlot,2613, 5.0, 2059
2(↑3). Mavil,5143, 5.0, 1797
3(↑5). Violy,13494, 5.0, 1688
4(↑↑). Sachiko,3406, 5.0, 1506
5(↑6). Ruby Ann S,6534, 5.0, 1440
6(↑↑). Febie,3328, 5.0, 1438
7(↑↑). Bechie,8477, 5.0, 1305
8(↑9). Pearl G,6203, 5.0, 1275
9(↓7). Frances B,7900, 5.0, 1260
10(↑↑).Aprille G,9146, 5.0, 1175

2017年2月11日土曜日

[Play Station4] how to play m2ts file with mediatomb

I used mediatomb as DLNA server for Sony Play Station 3.
Now I bought Play Station 4, at first I could not play same settings of mediatomb.

1. download Media Player for Play Station 4[Free].
2. change settings of mediatomb as below.

         <map from="mpeg" to="video/mpeg"/>
         <map from="vob" to="video/mpeg"/>
         <map from="vro" to="video/mpeg"/>
-        <map from="m2ts" to="video/avc"/>
+        <map from="m2ts" to="video/mpeg"/>
         <map from="mts" to="video/avc"/>
         <map from="asf" to="video/x-ms-asf"/>
         <map from="asx" to="video/x-ms-asf"/>


I think Play Station 4 does not support "video/avc", it must be "video/mpeg".

I put my configuration file(config.xml) at