2015/10/26

[Tracy] 善用工具 -- Tracy 讓 PHP Debug 變簡單了

過去在開發 PHP 專案, 在除蟲的過程當中, 只能利用有限的錯誤訊息, 加上過去的經驗, 才能一步一步解決 error!

今天有機會學到新工具 Tracy (https://github.com/nette/tracy), 真讓人覺得 Debug PHP 程式變簡單了~

1. Composer 安裝

composer require tracy/tracy

這樣該有的基本 library 就具備了


2. 如何使用?

先將 vendor/autoload.php 這支檔案引用進來

require __DIR__.'/vendor/autoload.php';


加上 Tracy\Debugger::enable(); 就可以馬上使用囉

2015/09/25

[Laravel] Gulp TDD - 出現 PHPUnit Permission Denied 的解決方法

今天小試一下 Laravel 的 php unit testing

基本跑 phpunit 成功沒問題



變更 gulpfile.js -- 使用 mix.phpUnit();

執行 gulp tdd -- 卻出現 ./vendor/bin/phpunit: Permission denied

2015/09/14

[VS2015] 安裝 TypeScript 後造成 JavaScript Intellisense 失效的解決方法

最近在 Visual Studio 2015 更新 TypeScript 後, 突然 JavaScript 的 Intellisense 失效了! 沒有 color highlight 也沒有 code hint... 怎麼會這樣~~~

僅 .ts 的檔案都還可以用... 但是...還是有些 js code 寫在 razor 頁面上呀....

原本想說跟之前 razor 語法失效類似, 執行 ./devenv.exe /resetuserdata 還是不行

最終爬文找到方法, 只要重裝 Universal Windows App Development Tools

參考資料:
http://stackoverflow.com/questions/32000562/vs-2015-no-highlighting-and-intellisense-in-js-files

重裝步驟:

控制台 -> 解除安裝或變更程式 -> 找到 Visual Studio 2015

選擇 "變更", 會開啟 VS 的介面, 選擇 "變更"

如果原先有勾 Universal Windows App Development Tools, 先勾消, 再重新勾選
然後執行 "更新" 就會把 JavaScript 的支援加回來了


最後再到 Program File 的 VS IDE

執行下列兩行執令, 就完成囉!!!

./devenv.exe /updateconfiguration
./devenv.exe /clearcache

呼~~ 已經不習慣沒有 intellisense 的世界, 雖然 code 都可執行, 就是不能少那種感覺!!


2015/09/05

[Vagrant] 在 Windows 10 及 Mac 安裝 Homestead 步驟流程

安裝 Vagrant 輕便虛擬機 Homestead


安裝步驟:

必要的軟體 (在 Windows 或 Mac 皆需先安裝)

1. Git (http://git-scm.com/)
2. VirtualBox (https://www.virtualbox.org/wiki/Downloads)
3. Vagrant (https://www.vagrantup.com/)

4. 加入 laravel/homestead

vagrant box add laravel/homestead

5. 下載 vagrant homestead 環境設定

git clone https://github.com/laravel/homestead.git Homestead

2015/08/26

[Git] 解決 Git - unable to determine absolute path of git directory

今天第一次在 USB 操作遠端 Git 版控, 出現:

unable to determine absolute path of git directory

解決方法: 在 PowerShell 輸入指令

Stop-Process -processname ssh-agent*

git pull

即可正確執行

Reference:
http://stackoverflow.com/questions/11539076/git-unable-to-determine-absolute-path-of-git-directory

2015/07/27

[PHP] 處理 magic_quotes_gpc

PHP 5.4 版已預設 off, 但仍有主機商把它開啟

如果 get_magic_quotes_gpc() 回傳為 1 時
可以用 stripslashes 來處理字串

http://php.net/manual/en/function.get-magic-quotes-gpc.php

2015/07/17

[Git] 移除右鍵選單的 Git 指令選項

Git 在 Windows 系統下預設安裝的右鍵選單指令, 說實在的真的很少用, 今天決定把它移掉

步驟很簡單:


1. 開啟 cmd.exe 命令提示字元



2. 切換到 Git 安裝目錄的 git-cheetah/ 輸入以下指令

64-bit

cd "C:\Program Files\Git\git-cheetah"
regsvr32 /u git_shell_ext64.dll
32-bit

cd "C:\Program Files (x86)\Git\git-cheetah"
regsvr32 /u git_shell_ext.dll

參考: How do I remove msysgit's right click menu options?