2011年3月23日

把 WP Content Slide 變成「側邊欄輪播」 (siderbar slide) 顯示

親自測試於 WP 版本: 3.1
我是在儘量不要寫 PHP 程式碼的情況下. 組合了幾個 wordpress 的 plugin 達成此側邊欄輪播功能 (或許有其它 plugin 可以有同樣的效果, 知道的人請通知一聲...)
image
需要的 plugins:

1. WP Content Slide

在 wordpress 中的 plugin 名字是 Content Slide Plugin。這個 plugin 的啟用, 需要用要一點點 WP 的程式碼才能順利顯示 (下文中會說明)。
裝好之後, 要修改 WP Content Slide Options: image width (寛度) 、height (高度),也可以設標題字的大小。
image
再來是設圖片轉換效果; Squares per width/height 是馬賽克效果的切割數 (下圖例中的是切成 5X5 格來顯示轉換效果); 格子太多, 會轉換地比較慢。另外就是要不要顯示圖片下方的黑色小方塊, 用來直接看某一張圖片。
image

接著是「圖片來源」的設定
image
看你是要用網內的文章分類 (category) 來輪播, 還是給一些圖片的網址
image
若選「Yes, Custom Images」, 則最多可輪播 5 張圖片, 設定方式如下
image
若選「No, Using Posts from a Category」, 則還有一個很重要的選項設定, 就是要顯示哪一類的文章t: Select a Category: 你如果已有訂定一些分類, 即可在以下的畫面看到其它的分類。
image
設定好要記得按「Save Settings」。

2. Shortcode Exec PHP

這個 plugin 是用來簡單地在 wordpress 執行 PHP 碼, 可用 short code 的方式重覆使用; 下面是它的編輯畫面: 第1 個是原始範例, shortcode 是用中括號 [hello_world]; 第2個則是我自己寫的, 配合前述的 Content Slide Plugin 來使用, shortcode 是 [sld], 等一下在第 3 個步驟中的 plugin 要用到的。
image
[sld] 的程式碼貼在下方, 以利讀者使用。
[code]
if(is_front_page())
{
if(function_exists('wp_content_slider')) { wp_content_slider();}
}
[/code]

is_front_page()

其中的第1行是判斷是否在首頁的 WP 內建函數 ;

if(function_exists('wp_content_slider'))

則是判斷 Content Slide Plugin 來有沒有安裝;

wp_content_slider()

這個則是用來顯示  Content Slide Plugin

3. Widget Entries

第 3 個用的是「Widget Entries」, 這個 plugin 可以運用簡單的 PHP碼, 自行創造方便使用於各種 theme 中的 widget; 編輯 widget 的畫面很像傳統的 wordpress post, 所以它應該可以搭配其它 widget 做出很有趣的側邊欄。
自行命名一個 widget, 我的例子是叫「myWidgets1」, 然後填入內容文字區。注意,不要在「預覽」模式下填; 請改選「HTML」後, 再填入 [sld] (如下圖)
image

4. 將你自建的 widget 加入側邊欄

最後一個步驟, 就是回到 WP 佈景主題下的模組, 將 widget entry 拉到你想要放的 Siderbar 中。這樣就完成了!!! (不要勾選 Show post title 比較好, 因為它會把 title 顯示在圖片下方)。

image

2011年3月21日

在 ubuntu 中 compile gretl 1.9.2

這是在 gretl-users mail list 中有人提及的方法 (還沒試過, 再找時間一試), 我以前的自行編譯 (compile) 的經驗是有很多 dependencies 的問題, 不知道以下的方法, 能否更簡單地 compile gretl


Uninstall gretl 1.8.7 and I compile the program directly from the
source.
It works. I also have Ubuntu 10.04.

Download the 1.9.2 version from:

http://prdownloads.sourceforge.net/gretl/gretl-1.9.2.tar.bz2

Unpack. Open a terminal and write:

cd [directory where is the gretl source]
sudo apt-get build-dep gretl
./configure
make
sudo make install

That's all

You can launch the program from the terminal or create an icon in the
menu.

2011年3月7日

wordpress 在 ubuntu 10.04 下的內建圖片編輯功能 (image editor)

wordpress 在 ubuntu 10.04 下的內建圖片編輯功能 (image editor)是不能用的, 必需在架好 wordpress 之後, 再自行用 synaptic 加安裝 php5-gd (會自動同時安裝 libt1-5), 安裝完之後,重啟 apache2
   sudo /etc/init.d/apache2 restart
就可以在上傳圖片時 (或媒體庫) 的畫面圖片下方, 看到 “編輯” 這個按鈕了!

To enable (built-in) ”image editor“ in wordpress under ubuntu 10.04, you have to install "php5-gd" module (automatically along with "libt1-5")。

2011年3月5日

擴大 virtualbox 中的 *.vdi 檔之虛擬硬碟容量

在 virtualbox 中, 一開始建立虛擬硬碟容量 *.vdi 檔, 在使用了一段時間後, 可能容量漸感不足, 如果你一開始是用 "動態延伸存放" 的方式建立的 vdi (virtual disk image), 則可以下指令來改變其原始選擇之容量:

VBoxManage modifyhd 檔名.vdi --resize 大小 (Mb)

, 如下例增加為 15000 Mb:

xxx@ubuntu$ VBoxManage modifyhd my-xp.vdi --resize 15000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

重啟 virtualbox 後, 可以看到硬碟容量已變為 14.92, 不過, 進原來 windows 的 vbox client, 容量似乎仍是原來的。不知實際上有沒有作用

2019/8/25補充:新增的空間,仍屬於 unallocated space,必須用像 gparted 的工具來調整(合併)大小才能使用喔

若要縮小空間,見  https://yinung2.blogspot.com/2018/06/virtualbox.html
參見:
VBoxManage 指令網頁
複製 virtualbox 中的 *.vdi 檔

test 貼圖

imageimage

快忘記 gretl 的自行 compile 指令了!

cd gretl/cvs/gretl
cvs update -d -P
./configure --enable-build-doc
sudo make install
sudo checkinstall

2011年3月3日

Wordpress 的上傳檔案大小限制

Wordpress 的上傳檔案大小限制為 2M, 不夠的話, 在 ubuntu 下要修改

sudo gedit  /etc/php5/apache2/php.ini

然後在 php.ini 中修改以下的設定 (等號後的數字只是參考, 請依你自己的需要更改)


max_execution_time = 300
max_input_time = 600
memory_limit = 160M
post_max_size = 500M
upload_max_filesize = 600M

(注意: upload_max_filesize 要大於 post_max_size 的數值)

最後別忘了重新啟動 apache, 在 ubuntu 終端機中下指令

sudo /etc/init.d/apache2 restart

UEC 在 ubuntu 之下

Ubuntu Enterprise Cloud

我有成功地安裝了 UEC, 但是發現, UEC 在虛擬伺服器的管理上, 有無法跨 node 的 CPU 限制, 也就是說, 如果每一個 node 是 2 個 CPU, 你無法在 UEC 下建立的任一個虛擬伺服器採用超過2 個 CPU。

這和我原來以為 UEC 可以提升效能 (結合多台 PC 的 CPU 一起運作) 的預期不符。

似乎, 要想另外的平行運算, 或 HPC 的概念, 在 google 找了一下, 或許可參考:

         High Performance Distributed File System and Parallel Data Processing Engine
或許可考慮申請國外的 resources: