【AWS】複数環境でAWS CLIを使い分ける
- 他のprofileを設定する
aws configure --profile hoge
- 鍵とか聞かれるので入力する
$ aws configure --profile sample AWS Access Key ID [None]: XXXXXXXXXXXXXXXX AWS Secret Access Key [None]: XXXXXXXXXXXXXXXX Default region name [None]: ap-northeast-1 Default output format [None]: json
- profileを指定して実行する
aws cmd --profile hoge
Flutterでレイアウト調整の際に、Containerの枠に色をつける
メモです。
Container( # 色 decoration: BoxDecoration( color: Colors.white, border: Border.all(color: Colors.red)), width: width, height: gifHeight, child: Center( child: Image.asset('images/logo.png'), ), ),
Flutterで画像を表示する
Flutterで画像を表示する
flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: # file指定でも、ディレクトリ指定でもいける。今回はディレクトリ指定にした assets: - images/
- 以下みたいに呼べる
Image.asset('images/logo.png')
参考
【rails】activerecord-importとelasticsearch-railsのimportがコンフリクトしたのでメモ
前提
- もともとrailsでElasticsearchを使用していて、後からactiverecord-importに依存しているライブラリを入れた。
$ bundle exec gem list | grep activerecord-import activerecord-import (1.0.8) $ bundle exec gem list | grep elasticsearch-rails elasticsearch-rails (7.1.1)
- 両方でrailsのmodelにimportというクラスメソッドを生やすので、コンフリクトしてしまい、Elasticsearchの処理が軒並みこけてしまった。
調査
- activerecord-import側にコンフリクトした場合の対応が載っていた。
Activerecord-Import adds the .import method onto ActiveRecord::Base. There are other gems, such as elasticsearch-rails, that do the same thing. In conflicts such as this, there is an aliased method named .bulk_import that can be used interchangeably.
aliasを使えみたいにかいてある。
対応
- なんかメソッドのalias使うの微妙だな〜と思ったので。
Model.__elasticsearch__.import
みたいな感じでつかうようにした。
参考
おしまい。
【Flutter】 クリップボードにコピーする
Flutterを最近プライベートで書いていて、クリップボードにコピーしたかったのでメモです。
組み込みライブラリであるっぽいのでそれを使います。
// クリップボードにコピーするメソッド void copyRoomLink() { final url = "http://localhost:3000/api/v1/hoge"; Clipboard.setData(new ClipboardData(text: url)); } // 呼び出すアイコンボタン IconButton( icon: const Icon(Icons.link), tooltip: 'copy to link', onPressed: () { copyRoomLink(room.id); }, ),
以上です。あざました〜〜
【Flutter】formとsubmitボタンを定義する
Flutterでフォームとsubmitとボタンを作成したかったのでメモです。
Widget build(BuildContext context) { final roomNameFocusNode = FocusNode(); final formState = GlobalKey<FormState>(); return Form( key: formState, child: Column( children: [ TextFormField( // 画面遷移時にformにオートフォーカスする autofocus: true, // キーボードでのEnter時の処理 onFieldSubmitted: (value) { print(value); }, // 追加 onSaved: (value) { }, ), FlatButton( child: Text('Save'), color: Colors.grey, // submitした時の処理 onPressed: () { }, ), ], ), ); }