phpmd/phpmd

composer require phpmd/phpmd

What is phpmd?
->It points out potential bugs, suboptimal code, complex expressions, unused parameters, methods, and properties.

About rulesets
The rule set that can be sepecified by PHPMD is as follows.

Clean code rule: cleancode
will point out about the dirty code.

Code size rule: codesize
Attempts to reduce code size by splitting if there are too many methods or large classes.

Discussion rule: controversial
Point out to use the camel case about the camel case and snake case that are often regarded as a problem in developing with PHP

Design rules:
Design issues that are related to software design.

Naming rule: naming
Point out long names, conversely short names etc.

Unused code rule: unusedcode
Find and point out unused code.

laravelcollective

composer require laravelcollective/html

む? なんだ、laravelcollectiveとは?
https://laravelcollective.com/

>セレクトボックスの組み立てやチェックボックスの初期状態の指定、CSRF対策のトークン埋め込みなどが簡単にできる
う~ん、使うのか?必要性があれば使いますかね。

linux cp command

[vagrant@localhost test]$ ls
[vagrant@localhost test]$ touch fileA.txt
[vagrant@localhost test]$ ls
fileA.txt
[vagrant@localhost test]$ cp fileA.txt fileA_copy.txt
[vagrant@localhost test]$ ls
fileA.txt fileA_copy.txt

ディレクトリ先にもコピーできる。
[vagrant@localhost test]$ mkdir dir
[vagrant@localhost test]$ ls
dir fileA.txt fileA_copy.txt
[vagrant@localhost test]$ cp fileA.txt dir/fileA_cp.txt
[vagrant@localhost test]$ cd dir
[vagrant@localhost dir]$ ls
fileA_cp.txt

cpコマンドオプション -rでディレクトリごとコピー
[vagrant@localhost test]$ ls
dir fileA.txt fileA_copy.txt
[vagrant@localhost test]$ cp -r dir dir2
[vagrant@localhost test]$ ls
dir dir2 fileA.txt fileA_copy.txt
[vagrant@localhost test]$ cd dir2
[vagrant@localhost dir2]$ ls
fileA_cp.txt

-f:コピー先に同じ名前のファイルがあっても警告なしで上書きをする。
[vagrant@localhost test]$ ls
dir dir2 fileA.txt fileA_copy.txt
[vagrant@localhost test]$ cp -f fileA.txt fileA_copy.txt
[vagrant@localhost test]$ ls
dir dir2 fileA.txt fileA_copy.txt
[vagrant@localhost test]$ cp -rf dir dir2
[vagrant@localhost test]$ ls
dir dir2 fileA.txt fileA_copy.txt

なるほど、ディレクトリのコピーはcp -rfが良さそうですな。

MySQL: LPAD(特定)の文字を左側に追加

LPAD関数を使用することで、第二引数で指定した文字数に達するまで文字列1の左側に文字列2を追加する

mysql> SELECT LPAD(‘1′,3,’0’);
+—————–+
| LPAD(‘1′,3,’0’) |
+—————–+
| 001 |
+—————–+
1 row in set (9.23 sec)

なるほど、文字列作るとき便利だなーこれ。

MySQL: 文字列を結合するCONCAT

mysql> SELECT CONCAT(‘My’,’SQL’,’関数’,’リファレンス’);
+————————————————–+
| CONCAT(‘My’,’SQL’,’関数’,’リファレンス’) |
+————————————————–+
| MySQL関数リファレンス |
+————————————————–+
1 row in set (0.83 sec)

nullが入っているとnullで返されるらしいんだが。。
mysql> SELECT CONCAT(‘My’,’SQL’,’NULL’,’リファレンス’);
+————————————————+
| CONCAT(‘My’,’SQL’,’NULL’,’リファレンス’) |
+————————————————+
| MySQLNULLリファレンス |
+————————————————+
1 row in set (1.82 sec)

あ、こうかな。
mysql> SELECT CONCAT(‘My’,’SQL’,NULL,’リファレンス’);
+———————————————-+
| CONCAT(‘My’,’SQL’,NULL,’リファレンス’) |
+———————————————-+
| NULL |
+———————————————-+
1 row in set (1.91 sec)

なるほどー

Stack Overflowで質問しよう

Teratailで質問するより、stack overflowで世界に聞いた方が生産的なような気がしてきた。
ということで、stack overflowで質問してみます。

How to upgrade Laravel 5.2 → 5.8

When upgrading laravel from 5.2 to 5.8, do I need to upgrade one by one each with 5.3, 5.4, 5.5, 5,6, 5.7, 5.8, and check each details of changes?
Or can I go to 5.8 at once by composer json upgrade?
I would like to know general upgrade method of Laravel 5.2 → 5.8?

https://readouble.com/laravel/5.3/en/upgrade.html
https://readouble.com/laravel/5.4/en/upgrade.html
https://readouble.com/laravel/5.5/en/upgrade.html
https://readouble.com/laravel/5.6/en/upgrade.html
https://readouble.com/laravel/5.7/en/upgrade.html
https://readouble.com/laravel/5.8/en/upgrade.html

うん、こっちの方が英語のコミュニケーションの勉強にもなるし、よさそう。

早く気づけば良かった。。

DINを見てみよう

DINはuniquloで使われているフォントだそうです。
https://www.uniqlo.com/jp/stylingbook/pc/user_styling

縦に細長いですね。Dinにもいろいろある様です。
「Din 1451 Alt」

更に細長い?
「OSP DIN」

「Bebas Neue」

“DIN” is a german font.
Originally, the font was made for industrial use, and it was said that the purpose was to unify the font such as the model number description in the industry to this “DIN”. So, “DIN” is an abbreviation of “Deutches Institut fur Normung” and Deutsches Institut fur Normung is the officcial name of DIN.

これは目的によるな~

ではユニクロのfontを見てみましょう。
https://www.uniqlo.com/jp/css/default.css
[ccs]
body{
font:13px ‘ヒラギノ角ゴPro W3′,’Hiragino Kaku Gothic Pro’,’游ゴシック’,’Yu Gothic’,’游ゴシック体’,’YuGothic’,メイリオ,Meiryo,sans-serif;
color: #000000;
background: #e6e6e6;
}
[/ccs]

なるほど、ヒラギノ角ゴPro W3か。iPhoneと一緒ですね。
ところで、webデザインの大手ってどこでしょう? IMK?
imjのサイトを見てみましょう。あ、どーでもいいですが、知り合いimjで働いてますね。

で、imsのfont-familyはというと
https://www.imjp.co.jp/resources/css/common.css

body, input, textarea, select, option, button {
  background: #fff;
  font-family: "Gotham SSm A", "Gotham SSm B", "メイリオ", Meiryo, "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, "MS Pゴシック", "MS PGothic", sans-serif;
  font-style: normal;
  line-height: 1.7;
  color: #000;
  font-size: 14px;
}

Gotham SSm A???????????????
なにいいいいいいいいいいいいいいいいいいいいいいいいいいいいい

San-serif Futura

Futura is a Latin-language sans-serif typeface announced by Paul Renner, who worked as a part-time lecturer at the Bauhaus in Germany in 1923. Futura is a Latin word meaning “future”.

Adobe Fonts: Futura
https://fonts.adobe.com/fonts/futura-pt

Futura is one of the most popular fonts in the world, and is used in many corporate logs.
ほう、会社のロゴはfuturaにしようかな。
A, M, V, Wが非対称で、〇が円になっているとのこと。

CCS3でfuturaは使えるようです。
CCS3で使える欧文フォント
– Futura
– Neue Helvetica
– Avenir
– Sackers Gothic
– DIN Next
– Garamond #3
– Trade Gothic
– Neue Frutiger
– VAG Rounded
– Univers

何?DINもCCS3で使えるんかい!!!

書評:ザッポス伝説

ザッポス伝説を勧められたので、電車の中で読み、昨日読了した。

ザッポスは、靴のスタートアップでCEOは台湾の日系アメリカ人と勘違いしていたが、実はハーバードの台湾系のアメリカ人のようだ。

この本、ページ数が400くらいあり、ボリュームが結構あるのだが、中身は面白かった。経営者の本の中では最も面白いと言っても過言ではないほど。
印象に残ったところは P65.
> どうやって顧客から注文を取るのか、私たちには作戦がありました。まず、ウェブサイトを無料で制作すると地元の商工会議所にアプローチします。次に、(一銭ももらっていないとは言わずに)商工会議所が顧客だと地元企業に話し、できるだけたくさんの地元企業と契約を結べば、お金はすぐにも転がり込んでくるという考えでした。

P.67
>モールと契約できれば、モール内にある各店舗に営業をかけて、モールが契約したのだから各店も右に倣うべし、と説得しやすくなるからです。

頭いいですね。成功している人の話を聞いた方が圧倒的に効率がいいと思いました。

P.111
>ザッポスの社員となった翌日、私はラスベガスで開催されたWSA(ワールドシューアソシエーション)主催の靴の展示会に行きました。
展示会なら飛び込みする必要がない

P.116、117、118
-着くテーブルを選ぶのは、自分で決められる最も重要なこと
-着いたテーブルで勝ち目がないとわかったら、テーブルを替わっても構わない
-強い手なら弱く見せ、弱い手なら強く見せる
-リスクが最小ではなく、期待値が大きいものを選ぶ
-長い目でみるゲームであることを忘れない。重要なのは最終結果である。

-ゲームの仕方を理解しないでゲームをしないこと
-スタミナと集中力が最もあるプレーヤーがたいてい勝つ
-希望を抱くな
-アドバイスを恐れない事

P.155
-謙虚であれ

P.168
カスタマー・サービスをザッポスの中心にとらえました

P.176
在庫の獲得

P.350
講演活動をしなければ決して起こらなかったでしょう

非常にクレバーですね。
>強い手なら弱く見せ、弱い手なら強く見せる
これは最近のテーマでもあります。「女で馬鹿っぽいのはただの馬鹿ではない」とよく言いますが、これは心理を突いてますね。

そして、本を読んで最も驚いたのは、訳者が「本荘修二」さんだったこと。ああああああああああああああああ
そういうことか。すげーびっくりした。
スタートアップコミュニティで本荘さんを知らない人はいないでしょう。

といことで、ザッポスというサイトがなかったので、生まれて初めてアマゾンでスニーカーを注文してみました。