Author Archive
FuelPHP FrameWork 進入! Enter~~
by admin on 一月.05, 2012, under PHP & MYSQL
安裝之前有說過哩:請參考 FuelPHP FrameWork 初體驗~~
之前說過 作者將APP 整個包在FrameWork 內的蠢話. 我可以不承認嗎XDD
其實算是給開發人員快速進入,實作體驗FrameWork用的.
如果要自行快速分離請先參考 同事強做:【程式筆記】建立一個FuelPHP的應用程式Git Repository
如果這樣不能滿足你,接下來江示範如何調整.
(continue reading…)

FuelPHP FrameWork 初體驗~~
by admin on 十二月.27, 2011, under PHP & MYSQL
FuelPHP is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start.
FuelPHP 衝著他以php 5.3 並以namespace 方式開發,輕量化FrameWork趕快來試用看看吧.
安裝
安裝方式不免俗來了,快速按裝.(不錯唷)
1 2 3 4 5 6 7 | $ curl get.fuelphp.com/oil | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 244 100 244 0 0 240 0 0:00:01 0:00:01 --:--:-- 1257 Password: $ |
ZFS on MAC OSX
by admin on 十一月.23, 2011, under Mac OSX
ZFS 是很好檔案系統,可惜因為種種原因…沒有機會在OSX 上面使用.
MACZFS
是好心人porting到MAC OSX上面,只要下載安裝包下來就可以直接使用.
以下是實際使用方式:
先查看目前磁碟使用狀況.
1 2 3 4 5 6 7 8 | # diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.1 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 300.9 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 4: Apple_HFS data 198.2 GB disk0s4 |
Gearman Install OSX
by admin on 十一月.18, 2011, under 未分類
安裝Gearman 在OSX上面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | $ sudo -s $ cd /tmp $ wget https://github.com/downloads/libevent/libevent/libevent-2.0.15-stable.tar.gz $ tar zxvf libevent-2.0.15-stable.tar.gz $ cd libevent-2.0.15-stable $ ./configure $ make $ make install $ cd .. $ wget https://launchpad.net/ubuntu/lucid/+source/libdrizzle/0.7-1/+files/libdrizzle_0.7.orig.tar.gz $ tar libdrizzle_0.7.orig.tar.gz $ cd libdrizzle-0.7/ $ ./configure $ make $ make install $ cd .. $ wget http://launchpad.net/gearmand/trunk/0.14/+download/gearmand-0.14.tar.gz $ tar zxvf gearmand-0.14.tar.gz $ cd gearmand-0.14/ $ ./configure $ make $ make install $ cd .. $ wget http://pecl.php.net/get/gearman-0.8.0.tgz $ tar zxvf gearman-0.8.0.tgz $ cd gearman-0.8.0 $ phpize $ ./configure $ make $ sudo make install /bin/sh /tmp/gearman-0.8.0/libtool --mode=install cp ./gearman.la /tmp/gearman-0.8.0/modules cp ./.libs/gearman.so /tmp/gearman-0.8.0/modules/gearman.so cp ./.libs/gearman.lai /tmp/gearman-0.8.0/modules/gearman.la ---------------------------------------------------------------------- Libraries have been installed in: /tmp/gearman-0.8.0/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable during execution See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/ $ which php /usr/bin/php $ php --info | grep -i configuration (11-17 13:30) Configuration File (php.ini) Path => /etc Loaded Configuration File => /private/etc/php.ini Configuration $ vi /private/etc/php.ini ======= 加入以下資訊 ====== extension_dir = " /usr/lib/php/extensions/no-debug-non-zts-20090626/" <~~這不一定要 extension="gearman.so" ======================== $ php --info | egrep -i "(configuration|gearman)" Configuration File (php.ini) Path => /etc Loaded Configuration File => /private/etc/php.ini Configuration gearman gearman support => enabled libgearman version => 0.14 |
Gearman Install on Ubuntu
by admin on 十一月.18, 2011, under PHP & MYSQL
gearman 在ubuntu 上不知哪個版本已無提供libdrizzlea模組.
導致要使用myql作為資料源已無法使用.
以下是自行編譯安裝方式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | $ sudo -s $ add-apt-repository ppa:gearman-developers/ppa $ apt-get update $ apt-get install libevent-dev gearman libgearman4 libgearman-dev libdrizzle0 libboost-program-options-dev libboost1.46-dev libboost-program-options-dev uuid-dev g++ libmemcache-dev libcloog-ppl0 $ wget https://launchpad.net/ubuntu/lucid/+source/libdrizzle/0.7-1/+files/libdrizzle_0.7.orig.tar.gz $ tar zxvf libdrizzle_0.7.orig.tar.gz $ cd libdrizzle-0.7/ $ ./configure $ make $ make install $ cd.. $ wget http://launchpad.net/gearmand/trunk/0.14/+download/gearmand-0.14.tar.gz $ tar zxvf gearmand-0.14.tar.gz $ cd gearmand-0.14/ $ ./configure libdrizzle_CFLAGS="-I/usr/local/include" libdrizzle_LIBS="-L/usr/local/lib -ldrizzle" $ make $ make install $ cd .. $ wget http://pecl.php.net/get/gearman-0.8.0.tgz $ pecl install gearman-0.8.0.tgz $ vi /etc/php5/conf.d/gearman.ini ==== 加入 ==== extension=gearman.so $ vi /etc/init.d/gearman-job-server =====編輯==== prefix=/usr/local PARAMS="--queue-type=libdrizzle --libdrizzle-host=mysql主機ip --libdrizzle-user=mysql帳號 --libdrizzle-password=mysql主機ip --libdrizzle-db=gearman --libdrizzle-table=gearman_queue --libdrizzle-mysql" ====加上註解==== #test -f /etc/default/gearman-job-server && . /etc/default/gearman-job-server ======================== DB gearman 要自行在mysql新增 資料表他自行會建立 $ service gearman-job-server start |
Git 與遠端Server 應用
by admin on 十一月.02, 2011, under Git
乘上篇文章gitolite 安裝.
當你開心使用git一陣子,又在網路上免費或付費支援git平台的版本控管後是否發覺….
真的好麻煩每次都要同步好幾台SERVER上面的repositories…
有沒有在push上server後自動幫你搞定呢?!
(continue reading…)
gitolite 安裝
by admin on 十一月.01, 2011, under FreeBSD, Git
FreeBSD gitolite 安裝
安裝:
1 | # cd /usr/ports/devel/gitolite ; make install clean; |
安裝結束最後面會看到以下提示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ============================================================================== Final gitolite installation instructions: Any ssh user can be a gitolite provider. Simply run the following command as the user: /usr/local/bin/gl-setup /path/to/admin.ssh.key.pub This will setup up the configuration files for gitolite, designating where the repositories are located and other options. The admin ssh key allows full access to the gitolite-admin repository where additional users and repositories can be configured. By default, the git user is created for use by gitolite. ============================================================================== ===> Correct pkg-plist sequence to create group(s) and user(s) ===> Registering installation for gitolite-2.1 ===> Cleaning for gitolite-2.1 |
MongoDB Sharing
by admin on 八月.18, 2011, under PHP & MYSQL
MongoDB Sharing

可以先看看官網介紹:Sharding Introduction
Shards 類似 Mysql 的Data nodes.
Config Servers 類似 Mysql 的Management node.
Routing Processes 類似 Mysql 的SQL node.
(continue reading…)
MongoDB VS Mysql 簡單測試.
by admin on 八月.03, 2011, under PHP & MYSQL, 未分類
廢話不多說.
MongoDB 使用 MongoDB Object Document Mapper測試.
Mysql 使用 Object Relational Mapper測試.
MongoDB部分:
config.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | < ?php require_once __DIR__ . '/../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php'; use Doctrine\Common\ClassLoader, Doctrine\Common\Annotations\AnnotationReader, Doctrine\ODM\MongoDB\Configuration, Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver, Doctrine\MongoDB\Connection, Doctrine\ODM\MongoDB\DocumentManager; $classLoader = new ClassLoader('Doctrine\Common', __DIR__ . '/../../lib/vendor/doctrine-common/lib'); $classLoader->register(); $classLoader = new ClassLoader('Doctrine\ODM\MongoDB', __DIR__ . '/../../lib'); $classLoader->register(); $classLoader = new ClassLoader('Doctrine\MongoDB', __DIR__ . '/../../lib/vendor/doctrine-mongodb/lib'); $classLoader->register(); $classLoader = new ClassLoader('Symfony', __DIR__ . '/../../lib/vendor'); $classLoader->register(); $classLoader = new ClassLoader('Documents', __DIR__); $classLoader->register(); $config = new Configuration(); $config->setProxyDir(__DIR__ . '/Proxies'); $config->setProxyNamespace('Proxies'); $config->setHydratorDir(__DIR__ . '/Hydrators'); $config->setHydratorNamespace('Hydrators'); $config->setDefaultDB('doctrine_odm_sandbox'); //使用safe模式 $con = new Connection('localhost',array('safe'=>true, 'w' => 2,'wtimeoutMS' => 2000)); //使用一般模式 //$con = new Connection('localhost'); $reader = new AnnotationReader(); $reader->setDefaultAnnotationNamespace('Doctrine\ODM\MongoDB\Mapping\\'); $config->setMetadataDriverImpl(new AnnotationDriver($reader, __DIR__ . '/Documents')); $dm = DocumentManager::create($con, $config); |
Lua for PHP 實測
by admin on 八月.02, 2011, under Lua, PHP & MYSQL
繼上一篇 Lua for PHP 安裝,現在來是實測Lua 速度.
素聞Lua 執行效能速度之優異不論是陣列字串運算處理皆在PHP之上,這篇先主要針對Array做實測.
index.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | < ?php $array_a = array(); for($i=1; $i<100000; $i++) { $array_a[$i]= rand(1,9999); } //新增Lua物件 並載入test.lua $lua=new plua('test.lua'); //複製一個陣列並丟到Lua 物件內 $array_b = $array_a; $lua->array_b = $array_b; //測試PHP物件排序效能 $mtime = explode(' ', microtime()); $starttime = $mtime[1] + $mtime[0]; //var_dump($array_a); rsort($array_a); //var_dump($array_a); $mtime = explode(' ', microtime()); $times=number_format(($mtime[1] + $mtime[0] - $starttime), 8); //顯示PHP執行結果所需時間 echo "PHP rsort time $times \n"; $mtime = explode(' ', microtime()); $starttime = $mtime[1] + $mtime[0]; //var_dump($array_b); //測試Lua物件排序效能 $array_b = $lua->test(); //var_dump($array_b); $mtime = explode(' ', microtime()); $times=number_format(($mtime[1] + $mtime[0] - $starttime), 8); //顯示Lua執行結果所需時間 echo "Lua array sort time $times \n"; |
test.lua
1 2 3 4 | function test()
table.sort( array_b )
return array_b
end |