I found I can use "git reset" when I want to store my changes to the remote git repository temporarily.
Here is a few steps to do that: (assume we are in the "develop" branch now)
a. store
a.1. git branch temp
a.2. git checkout temp
a.3. git commit -m "temporarily changes"
a.4. git push origin/temp
b. resotre
b.1 git pull origin/temp
b.2 git checkout origin/temp
b.3 git reset origin/develop
b.4 git push origin :temp # remove the remote temp branch
then, we done! All changes is back to the stages.
G.L. Island
Friday, July 27, 2012
Sunday, June 03, 2012
Facebook PHP Optimization
http://sizzo.org/wp/talks
http://www.slideshare.net/shire/php-tek-2008-apc-facebook
http://www.slideshare.net/shire/php-tek-2008-apc-facebook
Thursday, May 31, 2012
PHP Benchmarking Tools
1. ab: http://httpd.apache.org/docs/2.0/programs/ab.html
2. flood: http://httpd.apache.org/test/flood/
3. Web Capacity Analysis Tool: http://support.microsoft.com/kb/231282
reference: http://phplens.com/lens/php-book/optimizing-debugging-php.php
2. flood: http://httpd.apache.org/test/flood/
3. Web Capacity Analysis Tool: http://support.microsoft.com/kb/231282
reference: http://phplens.com/lens/php-book/optimizing-debugging-php.php
Sunday, May 13, 2012
Use Event Dispatcher in Symfony2
Just use the code below to get the "event_dispatcher" service, easy!
$eventDispatcher = $this->container->get('event_dispatcher');
Sunday, May 06, 2012
Compile PHP binary with Lua extension on Windolws 7
- download and install Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
- download PHP source code (php-5.3.11.tar.bz2) from: http://windows.php.net/download/
- download PHP SDK (php-sdk-binary-tools-20110915.zip) from: http://windows.php.net/downloads/php-sdk/
- download PHP Dependable libs (deps-5.3-vc9-x86.7z) from: http://windows.php.net/downloads/php-sdk/
- download PHP PECL Lua extension source code (lua-0.9.4.tgz) from: http://pecl.php.net/package/lua
- download and install Lua 5.1 from http://code.google.com/p/luaforwindows/downloads/list
install Lua at C:\Lua - create a directory at C:\php-sdk, unzip the php-sdk-binary-tools-20110915.zip into this directory
- open Microsoft Windows SDK v7.0 CMD Shell
- enter those commands below:
setenv /x86 /win7 /Release
cd C:\php-sdk
bin\phpsdk_setvars.bat
bin\phpsdk_buildtree.bat php-5.3.11 - unzip php-5.3.11.tar.bz2 into C:\php-sdk\php-5.3.11\vc9\x86\php-5.3.11
- create a directory at C:\php-sdk\php-5.3.11\vc9\x86\deps, unzip deps-5.3-vc9-x86.7z into this directory
- create a directory at C:\php-sdk\php-5.3.11\vc9\x86\pecl, unzip lua-0.9.4.tgz into C:\php-sdk\php-5.3.11\vc9\x86\pecl\lua
- back to Microsoft Windows SDK v7.0 CMD Shell, and enter those commands below:
cd C:\php-sdk\php-5.3.11\vc9\x86\php-5.3.11
buildconf
configure --disable-zts --enable-snapshot-build --with-lua=C:\Lua\5.1
nmake
nmake snap - go to the directory C:\php-sdk\php-5.3.11\vc9\x86\php-5.3.11\Release, you can get the PHP Winodows Binaries: pecl-5.3.11-nts-Win32-VC9-x86.zip and php-5.3.11-nts-Win32-VC9-x86.zip
- enjoy to use the binaries!
troubleshooting:
- "ext\calendar\jewish.c(324) : error C2001: newline in constant": open two files: jewish.c and calendar.c, re-save them with UTF-8 encoding.
- cd Release\php-5.4.7
..\..\..\..\bin\zip.exe -9 -q -r ..\php-5.4.7-nts-Win32-VC9-x86.zip .
The system cannot find the path specified.
cd ..\..
cd Release\pecl-5.4.7
..\..\..\..\bin\zip.exe -9 -q -r ..\pecl-5.4.7-nts-Win32-VC9-x86.zip .
The system cannot find the path specified.
cd ..\..
cd Release\php-test-pack-5.4.7
..\..\..\..\bin\zip.exe -9 -q -r ..\php-test-pack-5.4.7.zip .
The system cannot find the path specified.
cd ..\..
cd Release
..\..\..\..\bin\zip.exe -9 -q php-debug-pack-5.4.7-nts-Win32-VC9-x86.zip *.pdb
The system cannot find the path specified.
cd
Z:\PHP-SDK\_php54\vc9\x86\php-5.4.7-src\Release
cd
Z:\PHP-SDK\_php54\vc9\x86\php-5.4.7-src\Release
..\..\..\..\bin\zip.exe -9 -q -r php-devel-pack-5.4.7-nts-Win32-VC9-x86.zip php-5.4.7-devel-VC9-x86
The system cannot find the path specified.
cd ..\..
open Makefile, added a line as below after "PHP_SRC_DIR =C:\php-sdk\php-5.3.11\vc9\x86\php-5.3.11":
ZIP="$(PHP_SRC_DIR)\..\..\..\..\bin\zip.exe"
- There is no php_lua.dll.
The lua extension is static only.
reference1: Build your own PHP on Windows
reference2: Windows 中编译 PHP5.4 + xdebug
reference3: /dev/php/php-on-windows
pre-build DLLs: http://downloads.php.net/pierre/
Friday, February 17, 2012
Facebook 檢查是否有點擊讚按鈕 (Likes)
$appId = '1234567890'; // Facebook App Id $res = $this->facebook->api('/me/likes/' . $appId);回傳值:
{ "data": [ { "name": "應用程式名稱", "category": "Application", "id": "1234567890", "created_time": "2012-02-17T07:54:54+0000" } ], "paging": { "next": "" } }use FQL:
$appId = 1234567890; $query = array( 'likes' => "SELECT uid, page_id, type, profile_section, created_time FROM page_fan WHERE uid = me() AND page_id = "' . $appId . '", ); /** * 回傳值 * $response = array( * array( * 'name' => 'likes', * 'fql_result_set' => array( * array( * "created_time" => "1329468255", * "page_id" => "1234567890", * "profile_section" => "other", * "type" => "APP", * "uid" => "100000119629520" * ) * ) * ) * ); */ $responses = $this->facebook->api( array( 'method' => 'fql.multiquery', 'queries' => $query ) );Facebook Javascript Like button click event:
FB.Event.subscribe('edge.create', function(response) { //alert('You liked the URL: ' + response); } );
Tuesday, January 24, 2012
偵測是否要取得最新版本的 Flash 檔案
Flash loader 在開始取得檔案前, 先用 xxx?v=28172364656 的方式取得一個設定檔, 該設定檔帶的 v={microtime} 其時間單位為 load 檔時的時間郵戳, 以確保該設定檔每次都是 load 到最新的, 再將要取得的檔案列表放在該設定檔內, 每個檔案都用 yyy?v=123458 的方式做版本控制, 這樣應該可以讓 Flash loader 隨時都能取得最新的檔案
Subscribe to:
Posts (Atom)