masahiro0104の日記

プログラミング情報メモ

AtomEditor 設定 for Vue.js

download

https://atom.io/

package install

vi packages.txt

japanese-menu
editorconfig
line-ending-converter
auto-convert-to-utf8
file-icons
highlight-selected
              
autoclose-html 
 
language-vue
vue2-autocomplete
vuejs2-snippets
 
hyperclick              
js-hyperclick              
vue-hyperclick              
              
linter              
linter-eslint              
linter-ui-default              
intentions              
busy-signal              

option

vim-mode-plus

apm install --packages-file packages.txt

packages設定

 LF設定

line-ending-selector

Default line ending OS Default => LF

Linter Eslint設定

Fix errros on Saveにチェック

対象追加

source.js, source.jsx, source.js.jsx, source.babel, source.js-semantic, text.html.vue

以降、プロジェクト配下で実行

cd {プロジェクト}

editor config設定。 Vueプロジェクトの丸コピ

vi .editorconfig

# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

eslintrc設定

npm install --save-dev eslint eslint-plugin-vue@next
npm install --save-dev eslint-config-standard eslint-plugin-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node

もしくは、適当なところにインストールして、eslint設定のlocal node_modulesにパス設定

vi .eslintrc.js

module.exports = {
  extends: [
    'standard',
    'plugin:vue/recommended'
  ],
  rules: {
    // override/add rules settings here, such as:
    // 'vue/no-unused-vars': 'error'
  }
}```

Eclipse + Cent OS 6.7 + Xdebug でリモートデバッグ

前提条件

  • Cent OS と Mac OS でフォルダを共有できていること
  • Cent OS に apach + PHP + Xdebug をインストール済みであること
  • Macファイアウォール設定「外部からの接続をすべてブロック」のチェックを外しておくこと

Cent OS側 設定

xdebug.ini に以下を記載

/etc/php.d/xdebug.ini

; Enable xdebug extension module
zend_extension=/usr/lib64/php/modules/xdebug.so

; see http://xdebug.org/docs/all_settings
xdebug.remote_enable=1
xdebug.remote_log=/tmp/xdebug_remote_log
xdebug.remote_connect_back=1

HTTPサーバ再起動

service httpd restart

Mac OSEclipse設定

Eclipse 環境設定

Eclipse -> 環境設定 -> PHP -> 新規ボタン押下 f:id:masahiro0104:20150926222907p:plainCentOS のIPが「10.211.55.4」の場合
次へ f:id:masahiro0104:20150926222924p:plain 次へ f:id:masahiro0104:20150926222926p:plain 追加 f:id:masahiro0104:20150926222930p:plain CentOS と Mac の共有フォルダ を合わせる。
なお、上記は、CentOSの公開ディレクトリを共有フォルダにしている例 f:id:masahiro0104:20150926222935p:plain 完了 f:id:masahiro0104:20150926222943p:plain OK

Eclipse -> 環境設定 -> PHP -> デバッグ
PHPサーバをCentOSf:id:masahiro0104:20150926222947p:plain 適当にワークスペースPHPプロジェクト及びphpファイルを追加する
追加したphpファイルを右クリック、デバッグ構成選択
PHPサーバ等を変更する。 f:id:masahiro0104:20150926222955p:plain デバッグすれば、PHPファイルの先頭で自動的に止まる。

PhpStorm 9 + Cent OS 6.7 + Xdebug で リモートデバッグ

前提条件

  • ファイアウォールはとりあえず、切っておいた方が良い。
  • Cent OSのVMが作成済みであること
  • Cent OS に Xdebugがインストール済みであること
  • Cent OS と Mac OS 間で フォルダが共有済みであること
  • Mac OS に PhpStormがインストール済みであること
  • その他、インストール諸々...

Cent OS側

Xdebug設定

/etc/php.d/xdebug.ini

; Enable xdebug extension module
; zend_extension=xdebug.so

; see http://xdebug.org/docs/all_settings
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_log=/tmp/xdebug_remote_log
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
xdebug.idekey="phpstorm"

設定後、httpサーバ再起動

# service httpd restart

Mac OS

PHPプロジェクトを適当に作成

ここでは、xdebugプロジェクトを作成 f:id:masahiro0104:20151018213513p:plain

phpファイルを適当に追加

f:id:masahiro0104:20151018213601p:plain

設定画面起動

PhpStromメニュー > Preferences 選択

Cent OS のPHP設定

設定画面 > Languages & Frameworks > PHP > Interpreter 選択

f:id:masahiro0104:20151018213750p:plain

Cent OSの設定追加

設定画面 > Languages & Frameworks > PHP > Servers 選択

Mac OS 側と Cent OS 側のパスをマッピングさせておく。 f:id:masahiro0104:20151018213852p:plain

プロジェクトデバッグ設定 Remote Debug 追加

Runメニュー > Edit Configurations 選択

CentOS Debug 」を追加。なお、ide key は xdebug.idekeyの値を設定 f:id:masahiro0104:20151018213941p:plain

デバッグコネクション開始

Runメニュー > Start Listening For PHP Debug Connections 選択

デバッグ開始

Runメニュー > Debug 選択

表示されるダイアログでは、追加したデバッグ設定「CentOS Debug 」を選択
ブレークポイントを張った後に、任意のブラウザでPHPファイル参照すれば、ブレークする。

http://10.211.55.4/xdebug/hoge.php

f:id:masahiro0104:20151018214116p:plain

Eclipse に Vrapper をインストールする

手順

  • メニューのヘルプ > 新規ソフトウェアのインストール 選択
  • 使用可能なソフトウェアダイアログにて、
    作業対象に以下を入力して、Enterキー押下
http://vrapper.sourceforge.net/update-site/stable
  • Vrapper をチェックし、「次へ」押下 f:id:masahiro0104:20151002191942p:plain
  • 以降は次へボタン等を押下していけば問題ないので省略

SSH パスワードなしでサーバに接続する

ホスト側及びサーバ側実行コマンド

$ mkdir ~/.ssh
$ chmod 700 ~/.ssh

ホスト側実行コマンド

$ ssh-keygen -t Ed25519
Generating public/private Ed25519 key pair.
Enter file in which to save the key (/user/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /user/.ssh/id_ed25519.
Your public key has been saved in /user/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:xxxxxxx
The key's randomart image is:
+--[ED25519 256]--+
|  oo  ...        |
|  oo  ...        |
|  oo  ...        |
|  oo  ...        |
|  oo  ...        |
|  oo  ...        |
|  oo  ...        |
|  oo  ...        |
|  oo  ...        |
+----[SHA256]-----+

※ passphraseを求められるが入力なしでEnterキー押下

~/.ssh直下に下記鍵ファイルが作成される

id_ed25519.pub
id_ed25519

サーバ側に公開鍵転送

$ scp ~/.ssh/id_ed25519.pub user@hoge:~/.ssh/authorized_keys
user@hoge's password:
id_ed25519.pub                                100%   98    13.9KB/s   00:00

サーバ側実行コマンド

$ chmod 600 ~/.ssh/authorized_keys

mac sierra の場合 レガシーな鍵だとパスワードなしとならない。(ssh config設定要)

CentOS(6.7) に Zend Framework 1 をインストール

前提条件

手順

Zend Framework 1 インストール

# yum -y install --enablerepo=remi php-ZendFramework

php.ini 設定

# vi /etc/php.ini
include = ".:/usr/share/pear:/usr/share/php:/usr/share/php/Zend"

設定後、サーバ再起動

# service httpd restart

Zend Framework プロジェクト作成

$ zf create project projectZ
Creating project at /hoge/projectZ
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
PHP Fatal error:  Class 'PHPUnit_Framework_TestCase' not found in /usr/share/php/Zend/Test/PHPUnit/ControllerTestCase.php on line 48
PHP Stack trace:
PHP   1. {main}() /usr/share/php/Zend/zf.php:0
PHP   2. ZF::main() /usr/share/php/Zend/zf.php:623
PHP   3. ZF->run() /usr/share/php/Zend/zf.php:74
PHP   4. ZF->_runTool() /usr/share/php/Zend/zf.php:117
省略

エラーが発生するため、ControllerTestCase.php 冒頭にrequire_once追記。

# vi /usr/share/php/Zend/Test/PHPUnit/ControllerTestCase.php
/* add */
require_once 'PHPUnit/Autoload.php';

プロジェクトファイル削除後、再度実行

$ rm -rf projectZ
$ zf create project projectZ
Creating project at /hoge/projectZ
Note: This command created a web project, for more information setting up your VHOST, please see docs/README

Welcome ページ表示

作成したプロジェクトをApacheの公開ディレクトリに移し、
projectZ/public/index.phpにアクセス f:id:masahiro0104:20150928000055p:plain

Boot Camp AppleSSD.sysの署名でエラー

現象

Boot Camp を使って MacBookPro(OS X Yosemite) に Windows 7をインストールすると以下エラーが発生する。

ファイル:\Windows\system32\drivers\AppleSSD.sys

状態:0xc0000428

情報:このファイルのデジタル署名を検証できません。

対策

正式な手順でWindows 7 をインストールしていないことが原因。
Apple サポートサイトの「Windows 7 を新規インストールする」の手順を最初から実行すること。 support.apple.com