mozyのかきおき

mozyの読書感想文や思考置き場

Fiat money のFiat の意味

Fiat moneyとは

仮想通貨周りで聞くことがあるFiat moneyってなんだろうと思って調べてみた。

Fiat って単語は車のメーカーではなくって、「権威」とか「権力」を表すので、法定通貨を暗号通貨と区別して表現する時に使うらしい。

権威や権力の後ろ盾がある通過って意味で、Fiat moneyなんだね。覚えた。

Weexってな超イケてるネイティブアプリフレームワークを試してみる【25分でインストール&実機テストまで】

Weexてなによ

アリババが主導で開発していた、ネイティブアプリフレームワーク。 今はapacheプロジェクトに移管されている。
中身はVue。素敵。

weex.apache.org

インストール編

とりあえず、
npm -g i weex-toolkit webpack webpack-dev-server を叩いてライブラリ等をインストールする。
そして、サンプルプロジェクトを作る。
weex create weex-sample

以下が実行結果。インタラクティブに回答していけばいい感じにしてくれる。

weex ❯ weex create weex-sample
? May weex-toolkit anonymously report usage statistics to improve the tool over time? Yes
? Which npm registry you perfer to use? npm
23:48:51 : Set telemetry => true
23:48:51 : Set registry => http://registry.npmjs.org
Set telemetry = true
Set registry = "http://registry.npmjs.org"
23:48:51 : You can config this configuration again by using `weex config [key] [value]`
23:48:51 : Enjoying your coding time!

This command need to install weexpack. Installing...
? Project name weex-sample
? Project description A weex project
? Author MozyOk <mozy.okubo@gmail.com>
? Select weex web render lts
? Babel compiler (https://babeljs.io/docs/plugins/#stage-x-experimental-presets) stage-0
? Use vue-router to manage your view router? (not recommended) No
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Set up unit tests Yes
? Should we run `npm install` for you after the project has been created? (recommended) npm
23:53:26 : Generated weex-sample

ファイル生成が終わると、以下のように、コマンド一覧が出るのもナイス。

Success! Created weex-sample at /Users/mozyok/Test/weex/weex-sample

Inside that directory, you can run several commands:


  npm start
  Starts the development server for you to preview your weex page on browser
  You can also scan the QR code using weex playground to preview weex page on native

  npm run dev
  Open the code compilation task in watch mode

  npm run ios
  (Mac only, requires Xcode)
  Starts the development server and loads your app in an iOS simulator

  npm run android
  (Requires Android build tools)
  Starts the development server and loads your app on a connected Android device or emulator

  npm run pack:ios
  (Mac only, requires Xcode)
  Packaging ios project into ipa package

  npm run pack:android
  (Requires Android build tools)
  Packaging android project into apk package

  npm run pack:web
  Packaging html5 project into `web/build` folder

  npm run test
  Starts the test runner

To get started:

  cd weex-sample
  npm start

Enjoy your hacking time!

実行してみる

とりあえず、コマンド一覧にしたがって、

$ cd weex-sample
$ npm start

を叩いたら、ブラウザで以下のようなサンプルが実行された f:id:mozy_ok:20180421235904p:plain

このアプリをiPhoneなりにインストールして、QRコードを読み込んでみる。

Weex Playground

Weex Playground

  • Taobao (China) Software CO.,LTD
  • ユーティリティ
  • 無料

そうすると、実機のPlayground環境でも動作が試せた。めっちゃお手軽。すごい。 f:id:mozy_ok:20180422000638j:plain

まとめ

マジで15分で実機のPlayground環境で動作確認するまでできた。
Vueなので最近知見も多いし、ガシガシ書いていくと楽しそう。

証拠

1ポモドーロの間に間に合ったぜ。。 f:id:mozy_ok:20180422001402p:plain

【解決】MySQLのpasswordをなしにする

起きた事

local環境で色々遊んでいたところ、databaseを流し込もうとした時に以下のような、password があっていない時に出るエラーが起きた。

Access denied for user 'root'@'localhost' (using password: NO)
Couldn't drop database 'test_dev'

解決策

ちょっと手間だったので、mysqlにログインして、passwordの設定をなしにした。

$ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.6.39 Homebrew

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password='' where User='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
$ mysql -uroot   
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.6.39 Homebrew

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

passwordなしでログインできるようになった。やったね。

その他

MYSQL_ROOT_PASSWORD とか色々設定方法はあるけど、今回は一瞬だったので、簡単な方法で解決した。

3番地コードってなんだろ

3番地コードとは

拙い理解だと

output = input1 + input2

みたいに分解できる入出力の最小単位の処理を3つとするから? 3アドレスのコードというのかな。

x := i + m * n; は

t <- m * n

x <- i + t

という風に分解できるし。

 

他に、プロセッサの命令セットにおける3オペランド形式の場合、RISCプロセッサで、命令フォーマットから豊富なメモリアドレッシングを排して空いた空間を利用して、従来のCISCプロセッサに多かった2オペランド形式から、より最適化などに適した3オペランド形式としたRISCプロセッサが多いという経緯がある

3番地コード - Wikipedia

 

キーワード

【解決】mysql.server start で Permission denied エラー

起きたこと

mysqlを立ち上げようとしたらPermission deniedでエラーが起きた。
sudoをつけたら正常に起動する状態だった。

$ mysql.server start   
Starting MySQL
./usr/local/Cellar/mysql@5.6/5.6.39/bin/mysqld_safe: line 138: /usr/local/var/mysql/mozy.local.err: Permission denied

解決方法

/usr/local/var/mysql/を確認したところパーミッションが、_mysql となっていたので
sudo chown -R マシンのユーザー名 /usr/local/var/mysql/
例でいうと、sudo chown -R mozy /usr/local/var/mysql/として解決した。

副作用として、パーミッションが自分のユーザに変わったのでmysql起動時にsudoがいらなくなった。

環境

Mac OS X 10.13.3

【解決】Warning: Use php@7.1 instead of deprecated homebrew/php/php71

起きたこと

phpbrewや、brewphp環境を構築していたら、ターミナルを立ち上げた時に毎回、以下のようなWarningが出るようになってしまった。
Warning: Use php@7.1 instead of deprecated homebrew/php/php71

解決策

shellの~/.profile なり、~/.zshrcの中で
export PATH="$(brew --prefix homebrew/core/php71)/bin:$PATH" となっている部分を、
export PATH="$(brew --prefix homebrew/core/php@7.1)/bin:$PATH"
と変更したらWarningが出なくなった。

参考サイト

https://gist.github.com/pixeline/51c43c787f51b018d484597f30be3d2b