Author Archives: cowman.chiang

Git : non-fast-forward

當進行 gir push 發生 “non-fast-forward” 錯誤時 (如下面這個範例) root@ubuntu:/mnt/tdg_logs/blacklist/Git/master# git push -u 20140821 master Enter passphrase for key ‘/root/.ssh/id_rsa’: To git@cowman.no-ip.org:udn/udn_php-domain_name_query.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to ‘git@cowman.no-ip.org:udn/udn_php-domain_name_query.git’ To prevent you from losing history, … Continue reading

Posted in Git | Leave a comment

Vim 7.4 Backspace失效

差一點因為backspace失效就要把好不容易裝起來的Vim 7.4移除掉改裝yum的rpm了……. 原來只要輸入 “set backspace=2” 就可以了 所以可以將這一行放到 ~/.vimrc 中就可以了

Posted in Linux | Leave a comment

Ubuntu Domain Name 設定

Ubuntu 的 domain name 設定不像以往 Centos直接修改 /etc/resolv.conf 即可, 因為重開機, 理面的值會不見 仔細看了一下, 在開頭的地方寫著: # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN 所以我一直都再做白工…… 原來 Ubuntu 的 … Continue reading

Posted in Ubuntu | 1 Comment

Resize Virtual Disk – VMware ESXi 4.1 & CentOS 5.5 x86

使用vSphere Client登入調整硬體的設定,將硬碟空間增大 (由20G -> 80G) 將VM Guest重開機 以ssh登入VM Guest 輸入fdisk -l取得目前磁碟資訊 [root@localhost ~]# fdisk -l Disk /dev/sda: 85.8 GB, 85899345920 bytes 255 heads, 63 sectors/track, 10443 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start … Continue reading

Posted in CentOS, VMware | Leave a comment

Sublime Text 2 修改Tab設定

預設的Tab = 4個Spaces 寬度,這邊將它調整為2個Spaces寬度 Preferences -> Settings – More -> Syntax Specific -User 加入以下內容 { “tab_size”: 2, “translate_tabs_to_spaces”: true }

Posted in Sublime Text 2 | Leave a comment

Sublime Text 2 install PHP-Beautifier

環境:Windows 7 x64 安裝 PHP 1.1 http://windows.php.net/download/,選擇Installer最新版本下載安裝 1.2 將PHP安裝路徑加至Windows系統環境變數Path內 安裝php pear 2.1 下載http://pear.php.net/go-pear.phar至PHP目錄下 2.2 使用命令提示字元(以系統管理者啟動),切換至PHP目錄,輸入php go-pear.phar進行安裝 2.3 PHP目錄下會產生Pear_ENV.reg檔案,將它加入至系統內 PHP安裝PHP_Beautifier 3.1 在PHP目錄下,輸入pear install PHP_Beautifier-0.1.15進行安裝 3.2 修改PHP目錄下的php_beautifier,將error_reporting(E^ALL)修改為error_reporting(0),大約在第55行 3.3 修改PHP目錄下的php_beautifier.bat,將所有的改為/ 3.4 修改PHPpearPHPBeautifierFilter目錄下的Pear.filter.php及phpBB.filter.php,將require_once (‘PEAR/Config.php’);註解 Sublime Text 2安裝PHP_beautifier 4.1 Sublime Text 2安裝Package Control,進入Console模式(ctrl+`),輸入import urllib2,os; pf=’Package … Continue reading

Posted in PHP, Sublime Text 2 | Leave a comment

取得網路時間 (非更新系統時間)

Source: http://superuser.com/questions/635020/how-to-know-current-time-from-internet-from-command-line-in-linux 方法1 $ nc time.nist.gov 13 # Both commands query the timer server on TCP port 13 of the National Institute of Standards and Technology and output the received data on stdout. nc 指令說明 This is nc from the … Continue reading

Posted in Linux | Leave a comment

Post 檔案至Web CGI

第一種方式,linux curl command curl -vv –cookie “Session=798434368” –data-binary @RoxioMediaManager_test4_AAC-LC_v4_Stereo_CBR_64kbps_44100Hz_ok.aac http://192.168.251.156/CGI/MobileAudio 第二種方式,PHP cUrl

Posted in PHP | Leave a comment

PHP 下拉檔案選單

Posted in PHP | Leave a comment

PHP強迫輸出

Source: http://php.net/manual/en/function.ob-flush.php some problems with ob_flush() and flush() could be resolved by defining content type header : header( ‘Content-type: text/html; charset=utf-8’ ); so working code looks like this:

Posted in PHP | Leave a comment