AndroidStudio自体の色や、コードのColorThemeを変更する方法

AndroidStudioのColorThemeをいい感じにしたい

その場合は以下のサイトから適当なテーマをダウンロードして、AndroidStudioの「File > Import Setting」から簡単に設定出来る

color-themes.com

AndroidStudio自体の色を変えたい + アイコンをAtomIconっぽくしたい

その場合以下のMaterial Themeを使う。 www.material-theme.com

まず、「Cmd+,」でPreferenceを開いて「Plugins」で以下の2つをダウンロード

f:id:saneeeatsu:20190203093714p:plain
この2つを落とす

これでかなりいかした見た目に!

DockerでUnicodeError(Ubuntu)

問題

DockerでUbuntuのイメージを作成したところUnicodeErrorが出てしまう。

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

解決策

% apt-get install language-pack-ja
% update-locale LANG=ja_JP.UTF-8

参考

gitのコミットログで絵文字を使う(2ステップ)

色々書いてあるところが多いがポイントは以下の2つのみ。

1. テンプレートを作成

github.com

その他にテンプレートを作りたい際には以下のサイトが参考になる。 gitmoji.carloscuesta.me

2. configに設定

特定リポジトリで使用

あるリポジトリで使いたい場合は.commit_templateをリポジトリ直下に保存して以下のコマンドをリポジトリ内で実行。

$ git config commit.template .commit_template

全てのリポジトリで使用

全てのリポジトリで共有して使用したい場合は、~/ 配下にコピーし以下を実行。

$ git config --global commit.template ~/.commit_template  

Terminalで絵文字が文字化けするが、Atomを使っている場合以下のコマンドでコミットメッセージを書く際にAtomを起動出来る。

$ git config --global core.editor "atom --wait"

参考

qiita.com

【エラー】google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application

エラー

$ docker-compose up <SEVICE_NAME>
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started

解決方法

$ gcloud auth application-default login

Credentials saved to file: [/Users/saneatsuwakana/.config/gcloud/application_default_credentials.json]

後は、作成されたjsonファイルをGOOGLE_APPLICATION_CREDENTIALSに指定して読み込ませればOK。

dockerの場合は以下のように「docker-compose.yml」に記述する。

app_name:
    environment:
      - GOOGLE_APPLICATION_CREDENTIALS=application_default_credentials.json

その他

以下のエラーが出た場合...

ERROR - 403 POST https://translation.googleapis.com/language/translate/v2/detect: Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the translate.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.

公式サイトを参考に以下のコマンドでjsonファイルを作成する

$ gcloud iam service-accounts create <NAME>
$ gcloud projects add-iam-policy-binding <PROJECT_ID> --member "serviceAccount:<NAME>@<PROJECT_ID>.iam.gserviceaccount.com" --role "roles/owner"
$ gcloud iam service-accounts keys create <FILENAME>.json --iam-account <NAME>@<PROJECT_ID>.iam.gserviceaccount.com

Getting Started with Authentication  |  Authentication  |  Google Cloud

【MySQL】ERROR 1253 (42000): COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4'

エラー内容

mysqlにログインし、READMEに沿ってデータベースを作成する際に以下のエラーが発生した。

mysql> create database sns_manager default character set utf8mb4 collate utf8_general_ci;
ERROR 1253 (42000): COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4'

原因

これは、DB作成時のcharasetをutf8mb4と、mb4系の設定を行っているにもかかわらず、utf8_general_ciを指定していているために発生するらしい。

解決方法

CHARACTER SETが'utf8mb4'で作業したい場合ので、COLLATIONにutf8mb4_general_ciを指定してあげれば良い。

mysql> create database sns_manager default character set utf8mb4 collate utf8mb4_general_ci;
Query OK, 1 row affected (0.07 sec

参考

【Docker】ERROR: unauthorized: authentication required

環境

  • Mac: Mojave 10.Mojave 10.14.1
  • Doker: 18.09.0

エラー内容

あるプロジェクトをcloneしてきて以下のコマンドを打ったところでエラー発生。

$ docker-compose run init
Creating network "docker_default" with the default driver
Pulling db (mysql:5.7)...
ERROR: unauthorized: authentication required

解決方法

$ docker logout 
Removing login credentials for https://index.docker.io/v1/

$ docker-compose run init
Pulling db (mysql:5.7)...
5.7: Pulling from library/mysql
a5a792f73cd8: Pull complete
936316019e67: Pull complete

参考

github.com