MongoDB Sharing
MongoDB Sharing[
可以先看看官網介紹:Sharding Introduction
Shards 類似 Mysql 的Data nodes.
Config Servers 類似 Mysql 的Management node.
Routing Processes 類似 Mysql 的SQL node.
MongoDB VS Mysql 簡單測試.
廢話不多說.
MongoDB 使用 MongoDB Object Document Mapper測試.
Mysql 使用 Object Relational Mapper測試.
MongoDB部分:
config.php
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 實測
繼上一篇 Lua for PHP 安裝,現在來是實測Lua 速度.
素聞Lua 執行效能速度之優異不論是陣列字串運算處理皆在PHP之上,這篇先主要針對Array做實測.
index.php
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
function test()
table.sort( array_b )
return array_b
end
Lua for Windows 開發 筆記
下載:Lua 5.2.0-work2 – Release 1
先參考此篇教學Using Lua with C#並去 LuaInterface 下載回來,看了一下注意事項好像必須 Microsoft Visual C++ 2008 可轉散發套件 (x86) 一併下載回來比較保險.
後來找到 luaforwindows Windows底下Lua整合套件.
MongoDB 新手入門筆記~
Linux 安裝:
$ apt-get install mongodb-server mongodb-dev
$ sudo pecl install mongo
編輯php設定檔 加入 extension=mongo.so
php -m 即可以看到安裝好的擴充套件.
FreeBSD 安裝:
$ cd /usr/ports/databases/mongodb ; make install clean ;
$ cd /usr/ports/databases/pecl-mongo ; make install clean ;
php -m 即可以看到安裝好的擴充套件.
編輯/etc/rc.conf:
Lua for PHP 安裝
主要安裝擴充套件資訊 LUA for PHP
使用 Plua 為安裝源.
Linux 安裝方式:
先安裝好 lua:
$apt-get install lua5.1 liblua5.1-0-dev
先下載並解開:
$ cd /tmp
$ wget http://plua.googlecode.com/files/plua-1.0.0.zip
$ tar zxvf plua-1.0.0.zip
$ cd plua
$ phpize
$ whereis php-config
php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
$ rm -f include
$ ln -s /usr/include/lua5.1 include
$ ln -s /usr/lib lib
$ cd lib
$ ln -s /usr/lib/liblua5.1.a liblua.a
$ ln -s /usr/lib/liblua5.1.so liblua.so
$ cd ..
$ make
$ make install
Installing shared extensions: /usr/lib/php5/20090626/
$
自行編輯php 設定 增加extension=plua.so
FreeBSD 架設 redmine
redmine 安裝:
1.先更新本機的port tree
$ portsnap fetch update
2.安裝
cd /usr/ports/www/redmine; make install clean
Zend Framework 2.0 的一點筆記AutoLoader HelperBroker
此筆記心得:
AutoLoader改變:
require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader();
$loader->registerNamespace('ZFDebug', __DIR__ . '/../library/ZFDebug')
->registerPrefix('Phly_', __DIR__ . '/../library/Phly');
$loader->register();
Zend Framework 2.0 體驗~
Zend Framework 2.0
使用前請先參觀ZF2 wiki
安裝方式
前往GIT 作clone 動作取得整個程式.
使用方式
依照正常使用方式 zf create project test1….etc
設定檔與ZF1 不同之處
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "test"
resources.db.params.password = "123456"
resources.db.params.dbname = "test"
resources.db.params.charset = "UTF8"
resources.db.params.driver_options.1002 = "SET NAMES utf8"
resources.db.params.profiler.enabled = true
resources.db.adapter = "PdoMysql"
resources.db.params.host = "localhost"
resources.db.params.username = "test"
resources.db.params.password = "123456"
resources.db.params.dbname = "test"
resources.db.params.charset = "UTF8"
resources.db.params.driver_options.1002 = "SET NAMES utf8"
resources.db.params.profiler.enabled = true
resources.db.adapter 名稱因為整個架構名稱不同所以必須變更.
FreeBSD 架設 git Server
安裝:
#cd /usr/ports/devel/git; make install clean
------------------------------------------------------------------------
*************************** GITWEB *************************************
If you installed the GITWEB option please follow these instructions:
In the directory /usr/local/share/examples/git/gitweb you can find all files to
make gitweb work as a public repository on the web.
All you have to do to make gitweb work is:
1) Copy the files /usr/local/share/examples/git/gitweb/* to a directory on
your web server (e.g. Apache2) in which you are able to execute
CGI-scripts.
2) In gitweb.cgi, adjust the variable $projectroot to point to
your git repository (that is where you have your *.git project
directories).
*************************** GITWEB *************************************
*************************** CONTRIB ************************************
If you installed the CONTRIB option please note that the scripts are
installed in /usr/local/share/git-core/contrib. Some of them require
other ports to be installed (perl, python, etc), which you may need to
install manually.
*************************** CONTRIB ************************************
------------------------------------------------------------------------
===> Installing rc.d startup script(s)
===> Compressing manual pages for git-1.7.4.1
===> Registering installation for git-1.7.4.1
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/git-core/git-daemon
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/git_daemon
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://git-scm.org/
===> Cleaning for p5-subversion-1.6.15
===> Cleaning for cvsps-2.1
===> Cleaning for git-1.7.4.1