2011年8月15日

ubuntu server 切換 語言

可以在終端機中下指令

export LANG=en_US.UTF-8

或是
export LANGUAGE=en_US

之後就不會看到亂碼了(英文顯示)

參考: http://alphax-x.blogspot.com/2009/12/ubuntu-server.html

在 ubuntu desktop 中安裝 LAMP

利用 Synaptic 套件管理程式 安裝

按下「系統->管理->「Synaptic 套件管理程式」
按上方功能表「編輯->以任務配置標記套件」
勾選「LAMP server」,按下「確定」,
然後在出現的對話視窗中按下「標記」
回到 Synaptic, 再按上方之「套用」 鈕 ...
安裝 mySQL server 時, 要回答你想設的 root 密碼 (這個 root 是指 mySQL 的 root; 只適用於 mySQL, 不是 ubuntu 的 root)



如果要用 phpMyAdmin 的話, 要另外再安裝


Ubuntu 10.10之後的版本把任務配置套件功能拿掉了,所以需要用請手動
請使用以下兩個指令
sudo apt-get install tasksel
sudo tasksel install lamp-server

參考: http://it-easy.tw/ubuntu-lamp/

2011年8月7日

用 PPA 安裝 gnuplot for gretl under ubuntu 10.04

gnuplot 4.2 不 “完全” 相容於 gretl 的問題, 有更簡單的解決辦法了, 就是改用 ppa, update 後自動安裝, 不需要自行 compile 了 (自行 compile gnuplot 的方法,見我之前寫的 http://yinung2.blogspot.com/search/label/gnuplot

gnuplot 4.2 in default ubuntu 10.04 does not well support gretl. Gretl needs at least 4.4 to work normally.

You may use this ppa instead for the current version of gnuplot.

sudo add-apt-repository ppa:daniel-elstner/ppa
sudo apt-get update

Then upgrade your gnuplot to 4.4. 

see also https://launchpad.net/~daniel-elstner/+archive/ppa

2011年7月21日

在 ubuntu 11.04 裝 自行打包的 gretl 1.9.5

我成功地在 ubuntu 11.04  裝 自行打包的 gretl 1.9.5
1. 先依 “在 ubuntu 中 compile gretl 1.9.2” 這篇來下載 gretl-1.9.5.tar.bz2
2. 解壓縮到 (例如: /home/xxx/gretl/cvs/gretl) 後, 再於終端機中下指令:

    cd /home/xxx/gretl/cvs/gretl
    sudo apt-get build-dep gretl
    ./configure
    make
    sudo make install
    sudo cp /usr/local/lib/libgretl* /usr/lib
3. 最後,於終端機中下指令 gretl, 就完成了
    就連 gnuplot 也成功地換成 4.2 以後的版本,這樣 gretl 跑起來,畫圖中的中文就正常了

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")。