TRY AND ERROR

気になったこと、勉強したこと、その他雑記など色々メモしていきます。。Sometimes these posts will be written in English.,

Entries from 2017-04-01 to 1 month

Python-boto3でAWSのEC2インスタンスを立ち上げ、そのPublicIPを取得する

boto3とawscliを入れておく $pip install boto3 $pip install awscliAWSのCredentialsなどをセットする $ aws configure AWS Access Key ID [None]: アクセスキー AWS Secret Access Key [None]: アクセスキーシークレット Default region name [None]: regi…

ChatworkAPIがバージョンアップしました。

ChatworkAPIがv1からv2にバージョンアップしました。help.chatwork.com ユーザー数が増えてmessage_idの桁が足りなくなったみたいな感じか?? 対応としては、基本エンドポイントを変更するくらいです。以前アップしたChatworkのAPIラッパーについてはは修正…

How to check if index is exist in Array or Slice in Golang?

Go

I guess in Golang, there isn't any method to check that index is exist in Slice, for PHP like "isset()". So I take a method I made like below. func isset(arr []string, index int) bool { return (len(arr) > index) }By the way, in Golang when…

In CakePHP3, change just a specific table class's datasource.

If you want to get the Table objects to access to DB without appalently using ConnectionManager, I think you use the "TableRegistry" like following. TableRegistry::get("Yours"); Above then, "default" datasource in app.php is chosen. If you…

google-api-php-clientを使ったOAuth2認証で、セッションを使わずにコールバックを経由しても保持される任意のパラメータをセットする

OAuth2認証において、Googleに認証リクエスト → Google認証画面にてアプリ許可 → コールバック画面に遷移という流れの中で、コールバックをもらった際にどのユーザー(アプリ側の)で認証したかを持ち回る必要があった。 アプリ側で必要となる任意のパラメー…

In the HTML5, "readonly" attribute just works for text fields.

In the HTML5, "readonly" attribute just works for text fields like <input type="text"> or <textarea>... I didn't know about that!For example, in the case of to put an select tag.Like this, it doesn't work as you think. It is editable. <select readonly> <option value="</textarea>…