学習記録

2020-02-09に作成

個人用の学習記録。成果がなくとも毎日更新。

所有者限定モードのためこのボードには投稿できません ボードとは?

調べたこと

数日ぶりにLaravelの勉強を再開した時に調べたこと。

プロジェクトについてLaravelのバージョンを確認

composer.lockの下記の記述を確認する。

"name": "laravel/framework",
"version": "v7.20.0",

参考:How to know Laravel version and where is it defined?

モデルで該当テーブルのレコードを全件削除

> App\Article::truncate();

参考:How to delete all the rows in a table using Eloquent?

Laravel From Scratch

https://laracasts.com/series/laravel-6-from-scratch/episodes/32?autoplay=true

つまずいた点

URLに「?tag=personal」と書いても404が返ってくるので、@forelseで実装しした結果を確認できない。

参考

コメントに
「it gave you 404 because the name that you used is not inside the tag table in the database if you try "personal" which Jeffrey used you will get the same result result because personal is a tag that is in the database but it not linked to any article.」
とあるように、
tagsテーブルに存在する名前をクエリで指定したところ再現できた。


Coursera, Machine Learning, 2週目, Linear Regression

躓いた点
- Σ f(x)^2という式を(Σ f(x))^2と解釈したが、正しくはΣ(f(x)^2)の解釈が正しかった。
- θ^T * X のまま、theta' * Xで実装できると思っていた。
- 下の書き方に慣れない
- 1/2/m
- x.^2


不明点

Courseraでoctaveの課題を解いているが、処理を途中で中断させる方法がわからない。

調べたこと

Octaveでプログラムを途中で終了する方法

解決

Ctrl-cで中断できると問題文に書いてあった。
「If you wish to quit, typing ctrl-c will stop the program in the middle of its run.」


LPIC

調べたこと
静的ライブラリの拡張子はa(Archive)。https://stackoverflow.com/a/21283879

パーフェクトPHP

int

0xと0(8進)を先頭に付けることができる。
PHP_INT_MAXで最大を取得できる。最大値を超えるとfloatへキャストされる。
この型へのキャストには(int), (integer), intval()を使う。

float

floatと表記されるが、実際は倍精度浮動小数点(double)。
変数の初期化には実数(1.2)や指数表記(1.2e3)が使える。
キャストには(float), (double), floatval()を使う。

文字列

ダブルクォートの中で$を使うと変数として展開される。
${var}のようにどこまでが変数名か明記するべき。


LPIC あずき本

1.2.2 起動時のイベント確認

$ dmesg
起動時に行った処理を確認できる。
Diagnostic messageの略。

systemdを採用したシステムではjournalctlを使う。
$ journalctl
-k カーネルのバッファ内容
-b 起動時のメッセージ


Laravel From Scratch

https://laracasts.com/series/laravel-6-from-scratch/episodes/30

疑問

artisanでfreshする操作とrefreshする操作の違いがわからない。

調べたこと

helpを読む

$ php artisan help migrate:fresh
Description:
  Drop all tables and re-run all migrations
(略)
$ php artisan help migrate:refresh
Description:
  Reset and re-run all migrations
(略)

まだ分からないのでドキュメントを読んだところ、
ロールバックするか(refresh)、テーブルをドロップするか(fresh)の違いがあるようだ。