alamofireでresponse headerを取得したい。 備忘録。

Alamofireを使ってAPIpostはうまくできたのだがresponseの取得方法がパッとわからなかったのでメモ。

          Alamofire.request(url, method: .post,parameters: parameters, encoding: JSONEncoding.default).responseJSON{ response in
                switch response.result {
                case .success:
                    let json = JSON(response.result.value)
                    print("==========================")
                    print(response.request)  // original URL request
                    print("==========================")
                    print(response.response) // URL response_header
                    print("==========================")
                    print(response.data)     // server data
                    print("==========================")
                    print(response.result)   // result of response serialization
                    print("==========================")
                case .failure(let error):
                    print(error)
                }
            }

git branch rename したい。

git の作成済みのブランチの名前を変えて新しく作業したい。。。

。。。git rebaseをしてmerge 作業をしていたが、コンフリクトが発生してしまって、明らかに挙動がおかしい。 。。作業内容的にさほどめんどくさい処理という訳でもないので、新しく作業した方が楽。

という訳で、

以下、ブランチ名を issue1 からissue001 に変更する例

ローカルのブランチ名変更 git branch -m issue1 isssue001 リモートのブランチを消す git push origin :issue1 変更済みローカルブランチをプッシュ git push origin issue001

git flow で base branchを developから変えたかった。

$ git flow feature start 'ブランチ名'
とすると featureブランチとして、新規に作られる。

$ git flow feature start issue1 とかでやると、 feature/issue1 のようになるが、baseブランチが git flow initをした時に決める?(わからない)ようで、developブランチから派生してしまっている。。。

新規機能開発のreview待ちや。優先度高めのissueができた時に現状のブランチから新規にfeatureブランチを切り立く、いままでは

$ git branch ~~ とgit flowからそれてしまっていた。

そこで調べて見ると、

$git flow feature start [-F] []

とすれば baseブランチが指定できるようだ、 $ git flow feature start issue1 feture/issue1より優先度高いisssu2がきたら、

$ git flow feature start issue2 feature/issue1 とすればfeature/issue2から新規にfeatureブランチとして,issue2を作成することができた。

xcode textViewにborderセットしたかった。

@IBOutlet weak var textArea: UITextView!

override func viewDidLoad() {
    super.viewDidLoad()


    textArea.layer.borderWidth = 1.0    //ボーダーの幅
    textArea.layer.cornerRadius = 10.0    //ボーダーの角の丸み
     // textArea.layer.borderColor = UIColor.lightGray.cgColor
    let borderColor : UIColor = UIColor(red: 0.85, green: 0.85, blue: 0.85, alpha: 1.0)
    textArea.layer.borderColor = borderColor.cgColor

}

mysql error対応!なぜか動かなくなった!時用

個人的にmysqlエラーが出た時の対応を下記にメモ。

#なんかよくわからんけどややこしいエラー出た時。
$ mysql_upgrade -u root -p --force
→もしくは mysql_upgrade -u root --force
#パスワード設定してなければ下のコマンド使います。

## macOSなどのアップデートが原因で死ぬ時
$ xcode-select --install

#基本的に設定書き換えたら動かし直す必要あるので
$ pkill mysql
$ mysql.server start

#番外編...いやいやそれでも動かない時。
$ brew doctor  #brewの、依存関係の確認

エラー文はないですがsocket error(2)では そもそも起動してない時が多い $ mysql.server start

起動時などに、socket error(38) これは権限などが足りてない場合が多いので mysqlの設定ファイルなどがあるディレクトリに対してchownしてあげる必要がある

jupyter で seabornnが突然使えなくなった。 " ModuleNotFoundError: No module named 'seaborn' " jupyeterのupdate

結論:jupyterのアップデートで治った。

pip3 install -U jupyter

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-103076a70ec3> in <module>()
      2 import pandas as pd
      3 import matplotlib.pyplot as plt
----> 4 import seaborn as sns
      5 import numpy as np
      6 from numpy import nan

ModuleNotFoundError: No module named 'seaborn'

juoyterを使い始めて二ヶ月。やっとkaggleのチュートリアルタイタニックを挑戦しています。

ただ、先日まで問題なくできていた。モジュールのインポートでエラーに。。。。

そしてなぜか shift + enterで。実行がうまくできなかった。。。。。 原因はよくわからないです。

解決法

moduleがないって言われているからpip3でいれてやる。

pip3 install seaborn ただ、なぜかその後も反応が悪かったので。 pip3 install -U jupyter

てして、jupyterをupdateしたら治った。 なんだったんだろうか。。。

xcode9 ~indexind prebuildingが終わらない。~

先日より、swiftの勉強をはじめました。

swiftをはじめ、最初はbuildがうまくいっていたのに、突然buildができなくなった時があった。 15分近くまってましたw

変更したのは独自クラス。 User.swiftを作成して、Constractorの定義のみ。。。。

メモリや、プロセスみてもよくわからず。。。

cmd + Q しても終了できなくて、おかしいなぁと思ったら。

gyazo.com

やっぱりおかしかったみたい。

これで強制終了して解決しました。

p.s. build待ってる間に他のお仕事が進んだことは言うまでもない。。。。。