2009年1月18日星期日

把firefox 設為ubuntu 的 default browser


./firefox.exe -silent -setDefaultBrowser


firefox.exe 是program file 下的 , 而非安裝檔。

2009年1月17日星期六

my conky config


# Conky sample configuration
#
# the list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.

# set to yes if you want Conky to be forked in the background
background yes

# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=8

# Text alpha when using Xft
xftalpha 0.8

# Print everything to stdout?
# out_to_console no

# MPD host/port
# mpd_host localhost
# mpd_port 6600
# mpd_password tinker_bell

# Print everything to console?
# out_to_console no

# mail spool
mail_spool $MAIL

# Update interval in seconds
update_interval 5.0

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window no

# If own_window is yes, you may use type normal, desktop or override
own_window_type desktop

# Use pseudo transparency with own_window?
own_window_transparent yes

# If own_window_transparent is set to no, you can set the background colour here
own_window_colour black

# If own_window is yes, these window manager hints may be used
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 280 5

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Draw borders around graphs
draw_graph_borders no

# Stippled borders?
stippled_borders 8

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color black

# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
alignment middle_right
#alignment bottom_right
#alignment none

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 12
gap_y 12

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer none

# Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
#max_port_monitor_connections 256

# Maximum number of special things, e.g. fonts, offsets, aligns, etc.
#max_specials 512

# Maximum size of buffer for user text, i.e. below TEXT line.
#max_user_text 16384

# Timing interval for music player thread, e.g. mpd, audacious
#music_player_interval (update_interval is default)

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument


own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager


# stuff after 'TEXT' will be formatted on screen
TEXT
${font Bitstream:size=14}${color1}${time %Y-%m-%d %A}
${font Radio Space:size=55}${color1}${time %H:%M}
${voffset -15}${font ConkyWeather:size=36}c ${font Verdana:size=15}${voffset -5}${execi 3600 conkyForecast --location=CHXX0049 --datatype=LT} / ${execi 3600 conkyForecast --location=CHXX0049 --datatype=HT}
$stippled_hr
${font Verana:style=Bold:size=9}HDD Temperature: ${font Verana:size=8}${execi 3 ~/.conky/gethddtemp.sh}
${font Verana:style=Bold:size=9}GPU Temperature: ${font Verana:size=8}${execi 3 nvclock -T | grep "temperature" | grep "[0-9][0-9]" -o}°C
${font Verana:style=Bold:size=9}CPU Temperature: ${font Verana:size=8}${acpitemp}°C
${font Verana:style=Bold:size=9}CPU1: ${font Verana:size=8}${cpu cpu1}% ${cpubar cpu1}
${font Verana:style=Bold:size=9}CPU2: ${font Verana:size=8}${cpu cpu2}% ${cpubar cpu2}
${font Verana:style=Bold:size=9}RAM Usage:${font Verana:size=8}$color $mem/$memmax - $memperc% ${membar}
${font Verana:style=Bold:size=9}Swap Usage:${font Verana:size=8}$color $swap/$swapmax - $swapperc% ${swapbar}
$stippled_hr
${font Verdana:style=Bold:size=9}Name PID CPU% MEM
${font}${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${font}${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${font}${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${font}${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${font Verdana:style=Bold:size=9}Mem usage
${font}${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${font}${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${font}${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${font}${color lightgrey} ${top_mem name 4} ${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
$stippled_hr
${font Verana:style=Bold:size=9}IP Address: ${font Verana:size=8}${addr eth0}
${font Verana:style=Bold:size=9}Total Download: ${font Verana:size=8}${totaldown eth0}
${font Verana:style=Bold:size=9}Total Upload: ${font Verana:size=8}${totalup eth0}
${font Verana:style=Bold:size=9}Up Speed: ${font Verdana:size=8}${upspeed eth0} Kb/s ${font Verana:style=Bold:size=9}Down Speed: ${font Verdana:size=8}${downspeed eth0} Kb/s
$stippled_hr
${font Verana:style=Bold:size=9}BOINC:
${font Verana:style=Bold:size=9}${execi 10 perl ~/.conky/boinc.pl}
$stippled_hr
${font Verana:style=Bold:size=9}$nodename - $kernel on $machine

2009年1月13日星期二

用AUTOIT 打造自動安裝軟件

CONCEPT
  1. 執行安裝檔
  2. 等候
  3. 輸入
  4. 等候
  5. .
  6. .
  7. .
  8. 完成

執行:
Run("./install.exe")

等候:
WinWaitActive("title","inline")

輸入:
Send("!N")
-! 即 with alt

修正UBUNTU 下 NFS 關機不會UMOUNT的問題

umountnfs.sh 會自動umount所有的nfs。所以建立umountnfs.sh的連結檔,放在 /etc/rc0.d 興 /etc/rc6.d/下就可以了。

sudo ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh
sudo ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh


2009年1月12日星期一

套用YSlow!提供的建議 , 改進Apache 的效能

1) 打開需要的Apache_mod


首先要打開 authn_default , expires 兩個Apache_mod。 在Webmin下可輕易開啟。

要檢查相關的mod 是否正確開啟, 可以用PHP 的 phpinfo();


2) 修改httpd.conf


能改善的分別有三個, 分別為:
  • 取消eTag
  • 增加 Expires 的Header
  • 啟用Gzip


在httpd.conf下, 加上

FileETag None
ExpiresActive On
ExpiresByType text/css "access plus 60 month"
ExpiresByType text/javascript "access plus 60 month"
ExpiresByType application/x-javascript "access plus 60 month"
ExpiresByType image/gif "access plus 60 month"
ExpiresByType image/jpg "access plus 60 month"
ExpiresByType image/png "access plus 60 month"
ExpiresByType image/x-icon "access plus 1 month"
SetOutputFilter DEFLATE

2009年1月2日星期五

mootools 解決 a 不可以有 target 的問題

XHTML 1.0 Strict 限制了a 的tag內不可含有target的 property,
解決的方法是用javascript把全部含 rel="external"的a都用js的方法開新tab.
方法如下:

var ExternalLink=function(){
$$('a[rel="external"]').each(function(a){
a.addEvent('click',function(e){
var e = new Event(e);
e.stop();
window.open(a.getProperty('href'));
});
});
}