2010年11月10日

Wordpress MU 的設定

程式名稱:WordPress MU
官方網站:http://mu.wordpress.org/
程式下載:按這裡
備註事項:從WordPress3.0起整合於WordPress,所以直接下載WordPress。
假設你己裝好 Apache, PHP5, mySQL
  註: 要開始設定 WP, 首先要連上的網址是:
       http://xx.xx.xx.xx/wp-admin/
       才會啟動以上的設定程序

1. 要先安裝 WP 的單人版 (可參見: 如何架設安裝WordPress部落格?)
2. 裝好後, 修改 WP 目錄中的 wp-config.php, 在以下
    /* That’s all, stop editing! Happy blogging. */
    的上方加入一行:
define('WP_ALLOW_MULTISITE', true);
請另在「/var/www/wp-content」目錄下新建一個資料夾「blogs.dir」並設定資料夾屬性為「777」,讓用戶可上傳檔案。

3. 重新整理部落格後台,點擊左方【工具】 (Tools)→「網誌網路」(Network),進入後請將網誌網路的標題和聯絡信箱設定好,並點擊﹝安裝﹞(Install)。
  重新安裝一次 WP 時, 要刪除原在在 mySQL 中已建好的 schema (資料庫), 再重新建 schema)

4.  在剛剛改過的 wp-config.php 中相同的位置, 加入以下:
即在這一行 define('WP_ALLOW_MULTISITE', true); 的下方, 加入
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false ); $base = '/';
define( 'DOMAIN_CURRENT_SITE', 'xxx.xxx.xxx' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
 5. 在 wp-config.php 相同的子目錄下,新增一個 .htaccess 檔, 再貼上
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
6. 這樣應該就可以啟動 Wordpress MU 了, 如果子網站無法連結, 應該是 Apache 的 rewrite 功能未開啟

7. 開啟 Apache 的 rewrite 功能
先啟動 rewrite 模組, 在終端機中下指令:
sudo a2enmod rewrite
(在 ubuntu 中, Apache 的預設安裝路徑是 /etc/apache)
然後修改 /etc/apache2/sites-available 中的 default 檔, 將其中的 AllowOverride NONE, 改成 AllowOverride All, 如下

         
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

     
   

8. 重新啟動 apache, 在終端機中下指令

sudo /etc/init.d/apache2 restart
這樣應該就完成了!


==如果無法內建安裝外掛、佈景==
(試過 wp 4.2 on Mint 7)
在 wp-config.php 中的最後,加上幾行如下,即可啟動內建安裝:


if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}


另見: Wordpress 的上傳檔案大小限制



參見:


=== see also ===
Re: Where is Apache installed on Ubuntu?
Apache config files are in /etc/apache
Apache log files are in /var/log/apache
Apache libs are in /usr/lib/apache
Other files can be in /usr/share/apache, /var/lib/apache

2010年7月11日

Ubuntu Enterprise Cloud, UEC

Eucalyptus Beginner’s Guide – UEC Edition

Chapter 1 – Introduction to UEC and its components


雲端運算安裝 Ubuntu Enterprise Cloud install

 

HAProxy 當 server load balancer 

硬體 Citrix / Alteon / Foundry 這些 SLB hardware device 

BalanceNG

Crossroads 

LVS 好像比較是 系統備援 (see http://www.ibm.com/developerworks/linux/library/l-linux-ha/index.html)

Virtualbox 網路的模式

source: http://www.dotblogs.com.tw/cyl1688/archive/2009/08/14/10055.aspx

VirtualBox 網路的模式,如下共5種(手冊上面寫的,但是用途為何?)

1.not attached (不使用網路卡)   
會出現網卡,但是沒有連接 

2.network address Translation(NAT)  預設值  
這是最簡單的方法連到外面的網路,這是單向,外部網路無法存取GUEST電腦(如果使用ultravnc 是否可以?), 一些限制:
  1. icmp ,ping 應該可以使用,但其它工具可能無法穩定工作
  2. UDP ,接收UDP傳播可能會不穩定
  3. 不支援GRE(pptp vpn)
  4. 無法將主機的連接埠轉向< 1024(這是保留給系統使用)
    整合在virtualbox 內的dhcp server會提供IP ,第一個卡 10.0.2.0,第二個卡10.0.3.0以此類推

3.bridged networking 橋接介面卡 
(可參見 VirtualBox 網路橋接(Bridge)模式 under Ubuntu 一文)
Guest會透過dhcp取得新內部的IP,因此會有兩個對外實體IP (使用一個設備驅動程式,過濾由實體的網卡來的資料,這個驅動程式已經完整被重寫,HOST 不再需要複雜的設定),  設定網路時要選擇bridge,並選取實體網卡  

4.internal networking    可以讓不同虛擬主機互通,好像接到同一個hub上,但是無法存取外部網路
  1. 安全:
  2. 速度:比bridged networking有效,因為它是直接傳送,不需要透過HOST作業系統的網路堆疊
    IP 要手動指定
5.僅限主機介面卡 (host-only networking) 
    這是2.2版新增的模式,不同的GUEST可以互通,也可以跟HOST互通
    可以想像混合 bridged 和 internal 網路模式,在 HOST 會建立一個軟體的網路卡, 如同虛擬機器連線到虛擬的網路, 只可以讓HOST和GUEST互通

  1. virtualbox host-only networking 要使用dhcp 不可以指定
  2. virtualbox ->檔案->偏好設定->網路->點選host-only networking 可以設定dhcp如上兩個host-only和GUEST會有相同網段的IP,就可以互通
  3. 這裏的dhcp伺服器不同於其它模式,它是獨立的,也只有在這裏才會可以關閉,並指定ip的範圍

2010年7月4日

xorg.conf

Section "Device"
Identifier "Configured Video Device"
Driver "vesa"
EndSection

Section "Monitor"
Identifier "Configured Monitor"
Vendorname "Generic LCD Display"
Modelname "LCD Panel 1024x768"
Horizsync 31.5-48.0
Vertrefresh 50-60
modeline "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -vsync -hsync
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
Defaultdepth 24
SubSection "Display"
Depth 24
Virtual 1024 768
Modes "1024x768@60" "800x600@60"
EndSubSection
EndSection

2010年7月3日

試用 ubuntu 10.04

今天用 virtualbox 3.1.2 在 ubuntu 9.10 下試用 ubuntu 10.4 版, 結果 ubuntu 10.04 系統開啟地很慢很慢...
後來將 virtualbox 換成 3.2.6 版, 問題才解決

ubuntu 10.04 視窗風格有很大的改變, 最不適應的是放大縮小鈕改成放在左上角 ...
要更改為放在右上角的話:
  1. 在終端機啟動 gconf-editor
  2. 點選 Apps > Metacity > General > Button Layout
  3. 把字串值改成:menu:minimize,maximize,close
    (原來的值是: close,minimize,maximize:)
ubuntu 10.04 這一版的預設中文輸入法仍是 iBus + 注音輸入法, 新增倉頡 3 代後, 發現輸入法會記住你上一次所挑選的字, 總算有些進步...

ubuntu 10.04 這一版預載可安裝的 gretl 是 1.8.7
gnuplot 是 4.2.6-1
要在圖形中正常顯示中文, 請參見
http://gretl.sourceforge.net/gnuplot_for_gretl.html
測試的 gretl script
open djclose
smpl 1988/01/04 1989/12/29
gf1 <- gnuplot djclose --time-series --output=display --with-lines
gf1.show

先裝上 gretl 1.8.7 之後, 再
https://sites.google.com/site/gretlforubuntu/home/gretl-deb
下載自行編譯的 gretl 1.9.1, 但無法執行:
 /usr/local/bin/gretl_x11/: error while loading shared libraries: liblapack.so.

用 
sudo aptitude install libfftw3-dev
sudo aptitude install liblapack-dev
之後再重裝 gretl 1.9.1 即可 (比上一版 9.10 的簡單一些)


最後, 固定寛度字形預設是 monospace, 但要改成 freemono, 或 Courier 10 pitch 顯示才會對齊... 


若執行 ARIMA 模型估計時, 出現 /usr/lib/gretl-gtk2/arma.so 找不到, 則建立連結:
sudo ln -s /usr/local/lib/gretl-gtk2/ /usr/lib/gretl-gtk2/

2010年6月10日

Drupal 架站筆記-雙語言網站

用 Views 來做一個顯示「最新消息」的區塊
http://riemann.math.nccu.edu.tw/forum/viewtopic.php?f=8&t=637
Views 的選項:
  • Basic Information:  View 的名稱
  • 頁面: 要做一個 page 時要用這一個。
  • 區塊: 區塊的設定。因為我們要做的是「最新消息」的區塊, 所以選用這一項。
  • Fields: 選擇要把 Node 的什麼部份顯示出來, 例如標題 (Title)。
  • Arguments: ...。
  • 過濾器: 沒有要把所有的 Nodes 顯示出來時, 要設一些條件。
  • Exposed Filters
  • Sort Criteria
相簿 show:  Dynamic display block模組
http://chenyuyi.mis.nchu.edu.tw/drupal-6.16/node/59

待確認:
區塊 (block) 的雙語模型 要用哪一個模組?

待試用的 modules


Better Formats
不同 role 指定不同輸入格式 (是否允許 HTML)
http://drupal.org/project/better_formats



Nice Menus
下拉 css 選單
http://drupal.org/project/nice_menus

2010年5月10日

ASP 中的 codepage

放在 *.asp 的第1行:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
936代表是簡體中文,而950代表繁體中文,65001就是 UTF-8 編碼了


若你的 *.asp 是 UTF-8 編碼, 則加入以下的程式碼在第1行, 就不會有亂碼了

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>