在 Mac OS,使用 .dvdmedia 是一個保存 DVD 的便利方法,
要將 .dvdmedia 燒錄還原成 DVD 可使用 免費的 Burn,
只要將 .dvdmedia 拖拉進 Burn 直接燒錄即可,
Mac OS 真是好用!
2010年12月6日 星期一
2010年11月19日 星期五
2010年11月11日 星期四
2010 Subaru Outback 2.5i 油耗統計
2010年11月9日 星期二
在 wordpress.com 上發布 原始碼
之前一直都不知道要如何才可以貼 source code 而不需擔心排版與字元格式
今天參考了 這篇
才知道可以這樣做:
支援的程式語言有:
actionscript3, bash, coldfusion, cpp, csharp, css, delphi, erlang, fsharp, diff
groovy, javascript, java, javafx, matlab (keywords only)
objc, perl,php, text, powershell, python, r, ruby, scala, sql, vb, xml
今天參考了 這篇
才知道可以這樣做:
[sourcecode language="css"]
your code here
[/sourcecode]
支援的程式語言有:
actionscript3, bash, coldfusion, cpp, csharp, css, delphi, erlang, fsharp, diff
groovy, javascript, java, javafx, matlab (keywords only)
objc, perl,php, text, powershell, python, r, ruby, scala, sql, vb, xml
2010年10月21日 星期四
2010年10月14日 星期四
在 Mac OS X 上跑簡單的 Verilog
下載 MacPorts 並安裝
之後打開 Terminal
輸入:
輸入密碼後,就會自動安裝 iVerilog (Verilog Simulator)
執行方式:
之後打開 Terminal
輸入:
$ sudo port install iverilog
輸入密碼後,就會自動安裝 iVerilog (Verilog Simulator)
執行方式:
$ iverilog -o test ./test.v
$ ./test
2010年10月11日 星期一
Fail to Download Firmware to LPC2103
不知為什麼, 有時候要 Download Firmware to LPC2103 時會出現
下列錯誤訊息:
後來發現要檢查 Options for Target -> Utilities -> Setting 設定:
1. RAM for Algorithm: Star: 0x40000000, Size: 0x0800
2. Programming Algorithm: LPC2000 IAP2 32KB Flash
下列錯誤訊息:
No Algorithm found for: 00000000H - 00001FC3H
Programming skipped!
後來發現要檢查 Options for Target -> Utilities -> Setting 設定:
1. RAM for Algorithm: Star: 0x40000000, Size: 0x0800
2. Programming Algorithm: LPC2000 IAP2 32KB Flash
2010年10月7日 星期四
How to Outputs PDF File from Gnuplot
之前都是直接在 視窗輸出 之後再手動 列印成 PDF File
其實也可以直接輸出 PDF File:
搞定收工。
其實也可以直接輸出 PDF File:
gnuplot> set term pdf (will produce PDF output)
gnuplot> set output "printme.pdf" (output to any filename you use)
gnuplot> replot (recreates plot but you don't see it, goes to file)
搞定收工。
OpenSuSE 11.1 上的 TCL Library
閒閒沒事
把之前在 Mac OS 上 跑的 NAND Flash Static Wear Leveling 的 EV程式
拿到 SuSE 上跑,結果居然 Compile 不起來
發現是 "-ltcl" 無法 link 到 正確的 TCL Library
若將之改為 "-ltcl8.5" 就 OK
嗯
好像是 TCL Library 在 Install 時有問題
自己動手修正:
這樣 "-ltcl" 就 OK 了。
把之前在 Mac OS 上 跑的 NAND Flash Static Wear Leveling 的 EV程式
拿到 SuSE 上跑,結果居然 Compile 不起來
發現是 "-ltcl" 無法 link 到 正確的 TCL Library
若將之改為 "-ltcl8.5" 就 OK
嗯
好像是 TCL Library 在 Install 時有問題
自己動手修正:
$ (cd /usr/lib; sudo ln -s libtcl8.5.o libtcl.o)
$ (cd /usr/lib64; sudo ln -s libtcl8.5.o libtcl.o)
這樣 "-ltcl" 就 OK 了。
2010年9月21日 星期二
2010年6月24日 星期四
SVN + http + NIS Authentication on OpenSUSE 11.2
Step.1 Install OpenSUSE 11.2
- New Installation
- English
- select GNOME Desktop
- LVM Partitioning
/boot : 70.57MB
/ : 40GB
/srv : max
swap : 4GB - disable Fireware
- NTP: time.stdtime.gov.tw
- IP : 192.168.103.xxx
- Gateway : 192.168.103.254
- Subnet Mask : 255.255.0.0
- DNS : 192.168.xxx.xxx
- Hostname : svn
- domain: xxx
- server: 192.168.xxx.xxx
- Enable automount
- Check /etc/nsswitch.conf setting
passwd: files nis
group: files nis
shadow: files nis
hosts: files nis dns
- Apache Module
- http://download.opensuse.org/repositories/Apaches:/Modules/OpenSUSE_11.2
- RemoteDesktop
- http://download.opensuse.org/repositories/X11:/RemoteDesktop/OpenSUSE_11.2
- Visit http://en.opensuse.org/NVIDIA_drivers
- Update All Patches
- Install Apache
apache2
apache2-mod_perl, apache2-mod_php5,
apache2-mod_authnz_external
apache2-mod_security2
yast2-http-server - Install FTP server
pure-ftpd
yast2-ftp-server - Install Development Tools
gcc, gcc-c++, make, autoconf, compat
- enable sshd, autofs, httpd service
- create directory
#mkdir /srv/svn/projects
#mkdir /srv/svn/users - Change Owner
# chown -R wwwrun /srv/svn
# chgrp -R www /srv/svn - Create SVN Repository
# sudo -u wwwrun svnadmin create /srv/svn/projects
# sudo -u wwwrun svnadmin create /srv/svn/users
- Reference: http://forums.opensuse.org/get-help-here/network-internet/436171-nis-system-auth-apache-subversion.html
- Download pwauth source code, modify and Recompile
Download pwauth-2.3.8.tar.gz from http://code.google.com/p/pwauth/downloads/list
# tar -zxvf pwauth-2.3.8.tar.gz
# cd pwauth-2.3.8
# vi config.h
change
- #define SERVER_UIDS 72 /* user "nobody" */
to
- #define SERVER_UIDS 30 /* user "wwwrun" */
# make
# cp ./pwauth /usr/bin
# chmod 4755 /usr/bin/pwauth
- Install checkpassword-pam
Download checkpassword-pam-0.99.tar.gz from http://sourceforge.net/projects/checkpasswd-pam/files
# tar -zxvf checkpassword-pam-0.99.tar.gz
# cd checkpassword-pam-0.99
# ./configure
# make
# make install - create /etc/pam.d/httpd is
auth include common-auth
account include common-account
password include common-password
session include common-session - In /etc/apache2/default-server.conf, add:
AddExternalAuth pwauth /usr/bin/pwauth
AddExternalAuth checkpassword-pam "/usr/local/bin/checkpassword-pam -H --noenv --debug --stdout -s httpd -- /bin/true"
SetExternalAuthMethod checkpassword-pam checkpassword
AddExternalGroup unixgroup /usr/bin/unixgroup
SetExternalGroupMethod unixgroup environment - In the /etc/apache2/conf.d/subversion.conf:
DAV svn
SVNParentPath /home/srv/svn
SVNListParentPath on
# Limit write permission to list of valid users.
# Require SSL connection for password protection.
# SSLRequireSSL
AuthType Basic
AuthName "Subversion Server"
AuthExternal checkpassword-pam
AuthBasicProvider external
Require valid-user
AuthzSVNAccessFile /srv/svnaccess.conf
- In the /etc/apache2/conf.d/authnz_external.conf :
AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe - Enable aoache module and restart apache2
# a2enmod authnz_external
# a2enmod dav
# a2enmod dav_svn
# a2enmod authz_svn
# a2enmod perl
# rcapache2 restart
- # nxsetup --install --setup-nomachine-key --clean
SVN + http + NIS Authentication on OpenSUSE 11.2
Step.1 Install OpenSUSE 11.2
- New Installation
- English
- select GNOME Desktop
- LVM Partitioning
/boot : 70.57MB
/ : 40GB
/srv : max
swap : 4GB - disable Fireware
- NTP: time.stdtime.gov.tw
- IP : 192.168.103.xxx
- Gateway : 192.168.103.254
- Subnet Mask : 255.255.0.0
- DNS : 192.168.xxx.xxx
- Hostname : svn
- domain: xxx
- server: 192.168.xxx.xxx
- Enable automount
- Check /etc/nsswitch.conf setting
passwd: files nis
group: files nis
shadow: files nis
hosts: files nis dns
- Apache Module
- http://download.opensuse.org/repositories/Apaches:/Modules/OpenSUSE_11.2
- RemoteDesktop
- http://download.opensuse.org/repositories/X11:/RemoteDesktop/OpenSUSE_11.2
- Visit http://en.opensuse.org/NVIDIA_drivers
- Update All Patches
- Install Apache
apache2
apache2-mod_perl, apache2-mod_php5,
apache2-mod_authnz_external
apache2-mod_security2
yast2-http-server - Install FTP server
pure-ftpd
yast2-ftp-server - Install Development Tools
gcc, gcc-c++, make, autoconf, compat
- enable sshd, autofs, httpd service
- create directory
#mkdir /srv/svn/projects
#mkdir /srv/svn/users - Change Owner
# chown -R wwwrun /srv/svn
# chgrp -R www /srv/svn - Create SVN Repository
# sudo -u wwwrun svnadmin create /srv/svn/projects
# sudo -u wwwrun svnadmin create /srv/svn/users
- Reference: http://forums.opensuse.org/get-help-here/network-internet/436171-nis-system-auth-apache-subversion.html
- Download pwauth source code, modify and Recompile
Download pwauth-2.3.8.tar.gz from http://code.google.com/p/pwauth/downloads/list
# tar -zxvf pwauth-2.3.8.tar.gz
# cd pwauth-2.3.8
# vi config.h
change
- #define SERVER_UIDS 72 /* user "nobody" */
to
- #define SERVER_UIDS 30 /* user "wwwrun" */
# make
# cp ./pwauth /usr/bin
# chmod 4755 /usr/bin/pwauth
- Install checkpassword-pam
Download checkpassword-pam-0.99.tar.gz from http://sourceforge.net/projects/checkpasswd-pam/files
# tar -zxvf checkpassword-pam-0.99.tar.gz
# cd checkpassword-pam-0.99
# ./configure
# make
# make install - create /etc/pam.d/httpd is
auth include common-auth
account include common-account
password include common-password
session include common-session - In /etc/apache2/default-server.conf, add:
AddExternalAuth pwauth /usr/bin/pwauth
AddExternalAuth checkpassword-pam "/usr/local/bin/checkpassword-pam -H --noenv --debug --stdout -s httpd -- /bin/true"
SetExternalAuthMethod checkpassword-pam checkpassword
AddExternalGroup unixgroup /usr/bin/unixgroup
SetExternalGroupMethod unixgroup environment - In the /etc/apache2/conf.d/subversion.conf:
<Location /svn/>
DAV svn
SVNParentPath /home/srv/svn
SVNListParentPath on
# Limit write permission to list of valid users.
# Require SSL connection for password protection.
# SSLRequireSSL
AuthType Basic
AuthName "Subversion Server"
AuthExternal checkpassword-pam
AuthBasicProvider external
Require valid-user
AuthzSVNAccessFile /srv/svnaccess.conf
</Location> - In the /etc/apache2/conf.d/authnz_external.conf :
AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe - Enable aoache module and restart apache2
# a2enmod authnz_external
# a2enmod dav
# a2enmod dav_svn
# a2enmod authz_svn
# a2enmod perl
# rcapache2 restart
- # nxsetup --install --setup-nomachine-key --clean
2010年4月28日 星期三
Display Localized Directory Name on Mac OS X
如果你想建立一個目錄
並希望目錄名稱可以隨著『不同的系統語言設定』而『顯示不同的名稱』
範例:目錄 Work,在中文環境下顯示『工作』
步驟如下
1. change directory "Work" to "Work.localized"
2. create a diectory ./Work.localized/.localized
3. create a file ./Work.localized/.localized/en.strings
4. create a file ./Work.localized/.localized/zh_TW.strings
並希望目錄名稱可以隨著『不同的系統語言設定』而『顯示不同的名稱』
範例:目錄 Work,在中文環境下顯示『工作』
步驟如下
1. change directory "Work" to "Work.localized"
2. create a diectory ./Work.localized/.localized
3. create a file ./Work.localized/.localized/en.strings
"Work" = "Work";
4. create a file ./Work.localized/.localized/zh_TW.strings
"Work" = "工作";
2010年4月27日 星期二
Display Localized Directory Name on Mac OS X
如果你想建立一個目錄
並希望目錄名稱可以隨著『不同的系統語言設定』而『顯示不同的名稱』
範例:目錄 Work,在中文環境下顯示『工作』
步驟如下
1. change directory "Work" to "Work.localized"
2. create a diectory ./Work.localized/.localized
3. create a file ./Work.localized/.localized/en.strings
4. create a file ./Work.localized/.localized/zh_TW.strings
並希望目錄名稱可以隨著『不同的系統語言設定』而『顯示不同的名稱』
範例:目錄 Work,在中文環境下顯示『工作』
步驟如下
1. change directory "Work" to "Work.localized"
2. create a diectory ./Work.localized/.localized
3. create a file ./Work.localized/.localized/en.strings
"Work" = "Work";
4. create a file ./Work.localized/.localized/zh_TW.strings
"Work" = "工作";
2010年4月22日 星期四
自動影片分割
因為要上傳影片到 Youtube
必須將影片分割成數個不超過10分鐘長度的小片段
可是在 Mac OS X 下好像沒有好用的軟體
可又不想用 Quicktime 來一個一個手動分割
所以參考了一些資料後
寫了一個 AppleScript
File name : splite.scpt
[sourcecode language="text"]
(*
Splite Quicktime Movie into equally sized for Youtube
YF Chen
yfc@yfchen.com
*)
set sourceFile to choose file with prompt "choose video file as source"
set theFolder to (choose folder with prompt "Choose a folder for the slices:") as text
tell application "Finder"
my splitteVideo(sourceFile, theFolder)
end tell
on splitteVideo(sourceFile, theFolder)
tell application "QuickTime Player 7"
activate
try
open sourceFile
on error
display dialog "Open a movie first" buttons ["OK"] with title "Error"
return
end try
-- get active movie
set sourceDoc to document 1
set theDuration to duration of sourceDoc
set theTitle to name of sourceDoc
set DurOverlap to 2 -- 2sec overlaping
set DurScal to (90 * 1000)
-- calculate segments
set DurCut to (9 * 60) -- 9 min
set DurDoc to (duration of sourceDoc) / DurScal
set NumOfSeg to DurDoc div DurCut
-- loop each segment
repeat with i from 0 to NumOfSeg
-- set segment selection
set durStart to (i * DurCut) * DurScal
set durEnd to ((i + 1) * DurCut + DurOverlap) * DurScal
if durEnd > theDuration then
set durEnd to theDuration
end if
set selection start of sourceDoc to durStart
set selection end of sourceDoc to durEnd
-- copy selection into new movie
copy sourceDoc
set newdoc to make new document
paste newdoc
set theSlice to i as integer as string
set theFile to (theTitle & "_" & theSlice) & ".mov" as string
set theFile_full to (theFolder & theFile) as string
try
save self contained newdoc in theFile_full
end try
close document theFile
end repeat
close sourceDoc
quit
end tell
end splitteVideo
[/sourcecode]
必須將影片分割成數個不超過10分鐘長度的小片段
可是在 Mac OS X 下好像沒有好用的軟體
可又不想用 Quicktime 來一個一個手動分割
所以參考了一些資料後
寫了一個 AppleScript
File name : splite.scpt
[sourcecode language="text"]
(*
Splite Quicktime Movie into equally sized for Youtube
YF Chen
yfc@yfchen.com
*)
set sourceFile to choose file with prompt "choose video file as source"
set theFolder to (choose folder with prompt "Choose a folder for the slices:") as text
tell application "Finder"
my splitteVideo(sourceFile, theFolder)
end tell
on splitteVideo(sourceFile, theFolder)
tell application "QuickTime Player 7"
activate
try
open sourceFile
on error
display dialog "Open a movie first" buttons ["OK"] with title "Error"
return
end try
-- get active movie
set sourceDoc to document 1
set theDuration to duration of sourceDoc
set theTitle to name of sourceDoc
set DurOverlap to 2 -- 2sec overlaping
set DurScal to (90 * 1000)
-- calculate segments
set DurCut to (9 * 60) -- 9 min
set DurDoc to (duration of sourceDoc) / DurScal
set NumOfSeg to DurDoc div DurCut
-- loop each segment
repeat with i from 0 to NumOfSeg
-- set segment selection
set durStart to (i * DurCut) * DurScal
set durEnd to ((i + 1) * DurCut + DurOverlap) * DurScal
if durEnd > theDuration then
set durEnd to theDuration
end if
set selection start of sourceDoc to durStart
set selection end of sourceDoc to durEnd
-- copy selection into new movie
copy sourceDoc
set newdoc to make new document
paste newdoc
set theSlice to i as integer as string
set theFile to (theTitle & "_" & theSlice) & ".mov" as string
set theFile_full to (theFolder & theFile) as string
try
save self contained newdoc in theFile_full
end try
close document theFile
end repeat
close sourceDoc
quit
end tell
end splitteVideo
[/sourcecode]
自動影片分割
因為要上傳影片到 Youtube
必須將影片分割成數個不超過10分鐘長度的小片段
可是在 Mac OS X 下好像沒有好用的軟體
可又不想用 Quicktime 來一個一個手動分割
所以參考了一些資料後
寫了一個 AppleScript
必須將影片分割成數個不超過10分鐘長度的小片段
可是在 Mac OS X 下好像沒有好用的軟體
可又不想用 Quicktime 來一個一個手動分割
所以參考了一些資料後
寫了一個 AppleScript
(*
Splite Quicktime Movie into equally sized for Youtube
YF Chen
yfchen58i@gmail.com
*)
set sourceFile to choose file with prompt "choose video file as source"
set theFolder to (choose folder with prompt "Choose a folder for the slices:") as text
tell application "Finder"
my splitteVideo(sourceFile, theFolder)
end tell
on splitteVideo(sourceFile, theFolder)
tell application "QuickTime Player 7"
activate
try
open sourceFile
on error
display dialog "Open a movie first" buttons ["OK"] with title "Error"
return
end try
-- get active movie
set sourceDoc to document 1
set theDuration to duration of sourceDoc
set theTitle to name of sourceDoc
set DurOverlap to 2 -- 2sec overlaping
set DurScal to (90 * 1000)
-- calculate segments
set DurCut to (9 * 60) -- 9 min
set DurDoc to (duration of sourceDoc) / DurScal
set NumOfSeg to DurDoc div DurCut
-- loop each segment
repeat with i from 0 to NumOfSeg
-- set segment selection
set durStart to (i * DurCut) * DurScal
set durEnd to ((i + 1) * DurCut + DurOverlap) * DurScal
if durEnd > theDuration then
set durEnd to theDuration
end if
set selection start of sourceDoc to durStart
set selection end of sourceDoc to durEnd
-- copy selection into new movie
copy sourceDoc
set newdoc to make new document
paste newdoc
set theSlice to i as integer as string
set theFile to (theTitle & "_" & theSlice) & ".mov" as string
set theFile_full to (theFolder & theFile) as string
try
save self contained newdoc in theFile_full
end try
close document theFile
end repeat
close sourceDoc
quit
end tell
end splitteVideo
2010年3月31日 星期三
2010年3月30日 星期二
2010年3月15日 星期一
2010年3月14日 星期日
Subaru 2010 Outback Crash Test
2010 Subaru Outback NHTSA Frontal Impact
Subaru Outback crash test 5 star rating
Crash Test 2010 - 20** Subaru Outback (Side Impact) IIHS
Subaru Outback crash test 5 star rating
Crash Test 2010 - 20** Subaru Outback (Side Impact) IIHS
Subaru Outback CM
Parade
Outback 'Reverse Clean-up'
Lost Sunglasses
Hand Me Downs
Share the Love Commercial - Outback
Outback 'Reverse Clean-up'
Lost Sunglasses
Hand Me Downs
Share the Love Commercial - Outback
2010年3月11日 星期四
Install Trac on Mac OS
1. Download Trac
2. Create MySQL Table
執行 MySQL Tools 下的 MySQL Query Brower
並執行:
$ cd ~/Sites
$ svn co http://svn.edgewall.org/repos/trac/trunk trac
2. Create MySQL Table
執行 MySQL Tools 下的 MySQL Query Brower
並執行:
CREATE DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL ON trac.* TO tracuser@localhost IDENTIFIED BY 'password';
2010年3月9日 星期二
2010年3月8日 星期一
2010年2月1日 星期一
Enable TFTP Server on Mac OS X 10.6
Step.1 啟動 TFTP service
Step.2 變更 TFTP root directory (如果有必要的話)
TFTP root directory 的預設路徑是在 /private/tftpboot
如果想要變更的話,請修改 tftp.plist 的 tag,如:
修改完畢之後,tftpd 需要重新啟動
# sudo /sbin/service tftp start
Step.2 變更 TFTP root directory (如果有必要的話)
TFTP root directory 的預設路徑是在 /private/tftpboot
如果想要變更的話,請修改 tftp.plist 的 tag,如:
/usr/libexec/tftpd
-i
/Users/fly/tftp
修改完畢之後,tftpd 需要重新啟動
# sudo /sbin/service tftp stop
# sudo /sbin/service tftp start
2010年1月31日 星期日
Enable TFTP Server on Mac OS X 10.6
Step.1 啟動 TFTP service
Step.2 變更 TFTP root directory (如果有必要的話)
TFTP root directory 的預設路徑是在 /private/tftpboot
如果想要變更的話,請修改 tftp.plist 的 tag,如:
修改完畢之後,tftpd 需要重新啟動
# sudo /sbin/service tftp start
Step.2 變更 TFTP root directory (如果有必要的話)
TFTP root directory 的預設路徑是在 /private/tftpboot
如果想要變更的話,請修改 tftp.plist 的
<array>
<string>/usr/libexec/tftpd</string>
<string>-i</string>
<string>/Users/fly/tftp</string>
</array>
修改完畢之後,tftpd 需要重新啟動
# sudo /sbin/service tftp stop
# sudo /sbin/service tftp start
安裝 Altera USB-Blaster Driver for OpenSuSE 11.2
Step.1 新增 /etc/udev/rules.d/51-usbblaster.rules 內容如下
特別注意: 上面敘述"BUS==..."要在同一行
Step.2 新增 /etc/fstab 內容如下
Step.3 執行下面指令 或 直接重新開機也可
# USB-Blaster
BUS=="usb", SYSFS{idVendor}=="09fb", SYSFS{idProduct}=="6001", MODE="0666", \
PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; \
printf /proc/bus/usb/%%03i/%%03i$${K%%%%.*} $${K#*.}'", \
RUN+="/bin/chmod 0666 %c"
特別注意: 上面敘述"BUS==..."要在同一行
Step.2 新增 /etc/fstab 內容如下
usbfs /proc/bus/usb usbfs devmode=0666 0 0
Step.3 執行下面指令 或 直接重新開機也可
sudo mount /proc/bus/usb
2010年1月30日 星期六
安裝 Altera USB-Blaster Driver for OpenSuSE 11.2
Step.1 新增 /etc/udev/rules.d/51-usbblaster.rules 內容如下
特別注意: 上面敘述"BUS==..."要在同一行
Step.2 新增 /etc/fstab 內容如下
Step.3 執行下面指令 或 直接重新開機也可
# USB-Blaster
BUS=="usb", SYSFS{idVendor}=="09fb", SYSFS{idProduct}=="6001", MODE="0666", \
PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; \
printf /proc/bus/usb/%%03i/%%03i$${K%%%%.*} $${K#*.}'", \
RUN+="/bin/chmod 0666 %c"
特別注意: 上面敘述"BUS==..."要在同一行
Step.2 新增 /etc/fstab 內容如下
usbfs /proc/bus/usb usbfs devmode=0666 0 0
Step.3 執行下面指令 或 直接重新開機也可
sudo mount /proc/bus/usb
訂閱:
文章 (Atom)