Nov 9, 2011

Sep 21, 2011

解決 wordpress 自動 Update 的問題

Step.1 先到 FileServe.com 申請帳號,他會寄給你一個 FTP Account.
Step.2 到 Wrodpress 下設定 Auto Update 的 FTP 相關設定。

若看到:
Unable to locate WordPress Root directory.
Installation Failed

的錯誤訊息,則在 wp-config.php 檔案中加上以下幾行:
/* Fix Wordpress autoupgrades on Byethost.com */

putenv('TMPDIR=' . ini_get('upload_tmp_dir'));
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}


以上參考: Unable to locate WordPress Root directory. Installation Failed

另外,也要注意,wordpress 檔案目錄的權限設定是否正確。

Aug 19, 2011

安裝 MacPort 會卡住!?

剛才安裝 MacPort 2.0.1 時 居然一直卡住無法完成
顯示:『正在等待其他安裝完成』



最後只能強制結束

後來在網路上找到一個方法解決

Step.1 sudo rm /private/var/db/mds/system/mds.install.lock
Step.2 reboot

之後就正常了,真是奇怪!?

Aug 10, 2011

使用 DVD Decrypter 作 .dvdmedia 注意事項

在 Windows 下 用 DVD Decrypter 的 FIle Mode 作 DeCSS 後,
並將 目錄名稱 加上 .dvdmedia 在 Mac OS X 下 用 DVD 播放程式 播放,
卻出現 『不支援的媒體類型』的錯誤訊息,
後來才發現,必須要在 .dvdmedia 目錄下,手動建立 VIDEO_TS 的目錄,
並將 DVD Decrypter 所解出來的檔案放在 VIDEO_TS 目錄下,
就可正常在 Mac OS X DVD 播放程式 播放。
之前,在 Mac OS X 下使用 Ripit 解 DVD 建 .dvdmedia 時,
Ripit 會自動建立 VIDEO_TS 目錄,所以是 OK 的。

Aug 7, 2011

2010 Outback 2.5i 安裝 後車廂 12V 電源座

由於 Outback 無 後車廂 12V 電源座,
有時會造成不便,所以決定回廠加裝!

開始拆隔板


原廠已經有預留線路(紅色圈),加裝插座即可


原廠部品(價格還算便宜)





隔板鑽孔後,裝上插座


完工,搞定!



整個安裝過程,耗時約四十分鐘。

Aug 5, 2011

2010 Subaru Outback 2.5i 油耗統計

2010 Subaru Outback 2.5i 油耗統計

統計日期:2010/4/13 ~ 2010/11/4
儀表里程:3443 Km ~ 14187 Km

行駛里程:10744 km
總加油量:1092.79L
平均油價:NT$29.927/L

平均油耗:9.83 Km/L, NT$3.04/Km

汽油種類:
除了三次加到98汽油外,其餘均加95汽油。

行駛路況:
平日上下班都是 新竹 - 竹北 高速公路塞車來回(上班非常塞!下班還好),
週六、日,偶爾跑跑附近縣市(台北、桃園、苗栗、台中),很少跑山路。

May 9, 2011

gnuplot with aquaterm

自從 重新安裝的 Mac OS X 10.6 之後,一直忘了將 gnuplot 裝回去
可是用 macport 安裝了 gnuplot 卻發現 無法正常輸出到 aquaterm
輸出到 X11 是正常的,很奇怪。
gnuplot 安裝過程(aquaterm 會自動安裝):

$ sudo port install gnuplot

後來,發現一個奇怪的現象與解法,
aquaterm 似乎是安裝在 /Applications/MacPorts/AquaTerm.app 的路徑下
似乎與一般 Mac Port 的安裝路徑不同,一般都是在 /opt/local 下
奇怪的解法:只要先手動執行過 aquaterm 之後,就正常了:

$ /Applications/MacPorts/AquaTerm.app/Contents/MacOS/AquaTerm

May 6, 2011

OpenSuSE 11.4 Smaba 不會動?

升級到 OpenSuSE 11.4 之後,Samba 就不通了,
goolge 一下之後,發現是 Novell AppArmor 與 Samba 不合,
Samba 被 AppArmor 給檔了,
最後把 AppArmor 關掉,並重起 Samba 之後就OK了。

Apr 29, 2011

Simulate Armber on Mac OS

The Amber processor core is an ARM-compatible 32-bit RISC processor. The Amber core is fully compatible with the ARM® v2a instruction set architecture (ISA) and is therefore supported by the GNU toolset.
I would like to try run on my Mac Mini, so, I install Armber, tools and do some modification...

1. Download the Amber project from the Opencores Subversion server

$ mkdir ~/AmberInstallPath
$ cd ~/AmberInstallPath
$ svn --username YOUR_NAME -password PASSWORD co http://opencores.org/ocsvn/amber/amber/trunk

2. Install the GNU cross compiler

$ sudo port install arm-none-linux-gnueabi-gcc
$ sudo port install gawk
$ cd /opt/local/bin
$ sudo ln -s gawk awk
$ sudo ln -s arm-none-linux-gnueabi-gcc-2005q3 arm-none-linux-gnueabi-gcc

3. Install Icarus Verilog Simulator

$ sudo port install iverilog

4. Edit ~/.profile and add the following

$ export AMBER_BASE=~/AmberInstallPath/trunk
$ export AMBER_CROSSTOOL=arm-none-linux-gnueabi

5. Make scripts executable and create a run link

$ cd $AMBER_BASE
$ chmod +x hw/tools/*.sh sw/tools/*.sh
$ ln -s ../tools/run.sh hw/sim/run


6. Create $AMBER_BASE/hw/tools/runIV.patch by following

--- run.sh 2011-04-29 08:47:23.000000000 +0800
+++ runIV.sh 2011-04-29 09:14:21.000000000 +0800
@@ -46,12 +46,9 @@
AMBER_LOAD_MAIN_MEM=" "
AMBER_TIMEOUT=0
AMBER_LOG_FILE="tests.log"
-SET_G=0
SET_M=0
SET_D=0
SET_T=0
-SET_S=0
-SET_V=0
SET_A=0
SET_5=0

@@ -59,14 +56,11 @@ SET_5=0
# show program usage
show_usage() {
echo "Usage:"
- echo "run [-a] [-g] [-d] [-t] [-s] [-v]"
+ echo "run [-a] [-d] [-t]"
echo " -h : Help"
echo " -a : Run hardware tests (all tests in \$AMBER_BASE/hw/tests)"
- echo " -g : Use Modelsim GUI"
echo " -d : Create vcd file"
echo " -t : Create vcd file and terminate"
- echo " -s : Use Xilinx Spatran6 Libraries (slower sim)"
- echo " -v : Use Xilinx Virtex6 Libraries (slower sim)"
echo " -5 : Use Amber25 core instead of Amber23 core"
echo ""
exit
@@ -103,14 +97,8 @@ do
case $1 in
-a) SET_A=1 # all tests
shift ;;
- -s) SET_S=1 # Xilinx libs
- shift ;;
- -v) SET_V=1 # Xilinx libs
- shift ;;
-5) SET_5=1 # Xilinx libs
shift ;;
- -g) SET_G=1 # Bring up GUI
- shift ;;
-d) SET_D=1
DUMP_START=$2
shift 2;;
@@ -135,24 +123,7 @@ done
# Set comfiguration based on command-line options
#--------------------------------------------------------

-if [ $SET_G == 1 ]; then
- RUN_OPTIONS="-do cmd.do"
-else
- RUN_OPTIONS="${RUN_OPTIONS} -c -do run.do"
-fi
-
-if [ $SET_S == 1 ]; then
- FPGA="+define+XILINX_SPARTAN6_FPGA +define+XILINX_FPGA"
- RUN_OPTIONS="${RUN_OPTIONS} -t ps +notimingchecks -L unisims_ver -L secureip"
-else
- if [ $SET_V == 1 ]; then
- FPGA="+define+XILINX_VIRTEX6_FPGA +define+XILINX_FPGA"
- RUN_OPTIONS="${RUN_OPTIONS} -t ps +notimingchecks"
- else
- FPGA=" "
- fi
-fi
-
+RUN_OPTIONS="-f iverilog.f"

if [ $SET_D == 1 ]; then
AMBER_DUMP_VCD="+define+AMBER_DUMP_VCD +define+AMBER_DUMP_START=$DUMP_START"
@@ -173,13 +144,8 @@ else
fi

if [ $SET_A == 1 ]; then
- if [ $SET_S == 1 ]; then
- TECH="-s"
- elif [ $SET_V == 1 ]; then
- TECH="-v"
- else
- TECH=" "
- fi
+
+ TECH=" "

if [ $SET_5 == 1 ]; then
CORE="-5"
@@ -273,54 +239,42 @@ fi


#--------------------------------------------------------
-# Modelsim
+# iVerilog
#--------------------------------------------------------
-if [ $MAKE_STATUS == 0 ]; then
- if [ ! -d work ]; then
- vlib work
- fi
-
- if [ $? == 0 ]; then
- vlog +libext+.v \
- +incdir+../vlog/amber23+../vlog/amber25+../vlog/system+../vlog/tb+../vlog/ethmac \
- +incdir+../vlog/lib+../vlog/xs6_ddr3+../vlog/xv6_ddr3 \
- -y ../vlog/amber23 -y ../vlog/amber25 -y ../vlog/system -y ../vlog/tb -y ../vlog/ethmac \
- -y ../vlog/lib -y ../vlog/xs6_ddr3 -y ../vlog/xv6_ddr3 \
- -y $XILINX/verilog/src/unisims \
- -y $XILINX/verilog/src \
- ../vlog/tb/tb.v \
- $XILINX/verilog/src/glbl.v \
- +define+BOOT_MEM_FILE=\"$BOOT_MEM_FILE\" \
- +define+BOOT_MEM_PARAMS_FILE=\"$BOOT_MEM_PARAMS_FILE\" \
- +define+MAIN_MEM_FILE=\"$MAIN_MEM_FILE\" \
- +define+AMBER_LOG_FILE=\"$AMBER_LOG_FILE\" \
- +define+AMBER_TEST_NAME=\"$AMBER_TEST_NAME\" \
- +define+AMBER_SIM_CTRL=$TEST_TYPE \
- +define+AMBER_TIMEOUT=$AMBER_TIMEOUT \
- ${FPGA} \
- $AMBER_CORE \
- $AMBER_DUMP_VCD \
- $AMBER_TERMINATE \
- $AMBER_LOAD_MAIN_MEM
-
- if [ $? == 0 ]; then
- vsim -voptargs="+acc=rnpc" tb ${RUN_OPTIONS}
-
- # Set a timeout value for the test if it passed
- if [ $TEST_TYPE == 1 ]; then
- tail -1 /dev/null
- if [ $? == 0 ]; then
- TICKS=`tail -1 > $AMBER_LOG_FILE
-fi
+ echo "+libext+.v" > iverilog.f
+ echo "+incdir+../vlog/amber23" >> iverilog.f
+ echo "+incdir+../vlog/amber25" >> iverilog.f
+ echo "+incdir+../vlog/system" >> iverilog.f
+ echo "+incdir+../vlog/tb" >> iverilog.f
+ echo "+incdir+../vlog/ethmac" >> iverilog.f
+ echo "+incdir+../vlog/lib" >> iverilog.f
+ echo "+incdir+../vlog/xs6_ddr3" >> iverilog.f
+ echo "+incdir+../vlog/xv6_ddr3" >> iverilog.f
+ echo "-y../vlog/amber23" >> iverilog.f
+ echo "-y../vlog/amber25" >> iverilog.f
+ echo "-y../vlog/system" >> iverilog.f
+ echo "-y../vlog/tb" >> iverilog.f
+ echo "-y../vlog/ethmac" >> iverilog.f
+ echo "-y../vlog/lib" >> iverilog.f
+ echo "-y../vlog/xs6_ddr3" >> iverilog.f
+ echo "-y../vlog/xv6_ddr" >> iverilog.f
+ echo "+define+BOOT_MEM_FILE=\"$BOOT_MEM_FILE\"" >> iverilog.f
+ echo "+define+BOOT_MEM_PARAMS_FILE=\"$BOOT_MEM_PARAMS_FILE\"" >> iverilog.f
+ echo "+define+MAIN_MEM_FILE=\"$MAIN_MEM_FILE\"" >> iverilog.f
+ echo "+define+AMBER_LOG_FILE=\"$AMBER_LOG_FILE\"" >> iverilog.f
+ echo "+define+AMBER_TEST_NAME=\"$AMBER_TEST_NAME\"" >> iverilog.f
+ echo "+define+AMBER_SIM_CTRL=$TEST_TYPE" >> iverilog.f
+ echo "+define+AMBER_TIMEOUT=$AMBER_TIMEOUT" >> iverilog.f
+ echo "$AMBER_CORE" >> iverilog.f
+ echo "$AMBER_DUMP_VCD" >> iverilog.f
+ echo "$AMBER_TERMINATE" >> iverilog.f
+ echo "$AMBER_LOAD_MAIN_MEM" >> iverilog.f
+ echo "../vlog/tb/tb.v" >> iverilog.f
+
+ rm -rf ./armber
+ iverilog -f iverilog.f -o armber
+ ./armber



7. Create runIV script for iverilog simulator

$ cd $AMBER_BASE/hw/tools
$ patch -o runIV.sh -i runIV.patch
$ chmod +x runIV.sh
$ cd $AMBER_BASE/hw/sim
$ ln -s ../tools/runIV.sh runIV

8. If you see the iverilog compile error message for log2 function in next step, you could replace log2 by $clog2 to solve the problem.

9. Run a Hello-World Test with Amber 25

$ cd $AMBER_BASE/hw/sim
$ runIV -5 hello-world

10. Hello-World simulation Result

Amber Boot Loader v20110202130047
Hello, World!

----------------------------------------------------------------------------
Amber Core
> User FIRQ IRQ SVC
r0 0x00000010
r1 0x16000000
r2 0x00000000
r3 0x00000000
r4 0x0c80e403
r5 0x00000000
r6 0x00000000
r7 0x00000000
r8 0xdeadbeef 0xdeadbeef
r9 0xdeadbeef 0xdeadbeef
r10 0x00000011 0xdeadbeef
r11 0xf0000000 0xdeadbeef
r12 0x00000000 0xdeadbeef
r13 0x08000000 0xdeadbeef 0xdeadbeef 0x01ffffb8
r14 (lr) 0x0080e420 0xdeadbeef 0xdeadbeef 0x20000787
r15 (pc) 0x0080e960

Status Bits: N=0, Z=1, C=1, V=0, IRQ Mask 0, FIRQ Mask 0, Mode = User
----------------------------------------------------------------------------

++++++++++++++++++++
Passed hello-world 29320 ticks
++++++++++++++++++++

Apr 25, 2011

MacPort selfupdate fail ?

剛才突然發現,做 MacPort 的 selfupdate 時會失敗,
上次做還 OK 啊..?

$sudo port -f selfupdate
Warning: No index(es) found! Have you synced your source indexes?
---> Updating the ports tree
Error: Synchronization of the local ports tree failed doing rsync
Error: /opt/local/bin/port: port selfupdate failed: Couldn't sync the ports tree: Synchronization of 1 source(s) failed

測試一下公司網路:

$ telnet rsync.macports.org 873
Trying 17.254.20.244...

嗯,Port 873 出不去!
沒想到,公司 MIS 連 rsync 的 port 也給封了!真是麻煩,
費了一番功夫後,
終於可以做 selfupdate 了:

$ sudo port selfupdate
Warning: No index(es) found! Have you synced your source indexes?
---> Updating the ports tree
---> Updating MacPorts base sources using rsync
MacPorts base version 1.9.2 installed,
MacPorts base version 1.9.2 downloaded.
---> MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated