2012年2月8日星期三

FreeBSd 設定 ports 抓取檔案 Server

修改 /etc/make.conf

加入以下設定:

# Port master sites.
#
# If you want your port fetches to go somewhere else than the default
# (specified below) in case the distfile/patchfile was not found,
# uncomment this and change it to a location nearest you. (Don't
# remove the "/${DIST_SUBDIR}/" part.)
#

MASTER_SITE_BACKUP?= \
ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp5.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp10.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp3.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp4.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp7.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp8.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp9.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp11.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp12.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/

#
# If you want your port fetches to check the above site first (before
# the MASTER_SITES specified in the port Makefiles), uncomment the
# line below. You can also change the right side to point to wherever
# you want.
#
MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}


2011年12月29日星期四

Javascript 與 PHP 傳遞跳脫 URL

前提:Magic Quotes OFF

encodeURIComponent (Javascript)
rawurldecode (PHP)


2011年12月23日星期五

jQuery Plugin flog - Formatted Log

flog 意思為 Formatted Log

由此篇文章得到靈感。
http://blog.darkthread.net/blogs/darkthreadtw/archive/2008/12/31/jquery-logging-plugin.aspx

沒有 Firebug 時,會自動忽略此功能。
並導入了 Console.log 的 Format 字串 與 無限參數個數。
外加判斷,若第一個參數為 Format 字串 且 選擇對象為 使用者選擇之目標,則將 Format 字串後加入 ": %o" 以顯示 使用者選擇目標。

原始碼:

/*
* jQuery Formatted Log Plugin v1.0.0 @ 20111223
*
* Print formatted log to console.log with smart object display.
*
* Copyright (c) 2011 Firch Tsai
*
* Licensed under the GPL v2 licenses.
*/
jQuery.flog = jQuery.fn.flog = function(msg) {

if (typeof console != "undefined")
{
var arguments_array = [];

for (var i in arguments)
{
arguments_array[i] = arguments[i];
}

var first_arg = arguments_array.shift();

if(typeof first_arg == "string" && this.selector != $.selector)
{
first_arg += ': %o';
arguments_array.push(this);
}

arguments_array.unshift(first_arg);


var logfn = console.log;
logfn.apply(this, arguments_array);
}

return this;
};


使用範例:

item = "Book";
$.flog("This is a %s !", item);

將輸出:
This is a Book !


使用範例:

tag_name = "Links";
$('a').flog("These %s are Formatted", tag_name );

將輸出:
These Links are Formatted: +[a... , a...]


2011年11月11日星期五

2011年11月9日星期三

svn diff 使用 vimdiff

首先寫好 wrapper,明名為 .svndiff_to_vimdiff

#!/bin/sh

# Configure your favorite diff program here.
DIFF="/usr/local/bin/vimdiff"

# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}

# Call the diff command (change the following line to make sense for
# your merge program).
$DIFF $LEFT $RIGHT

# Return an errorcode of 0 if no differences were detected, 1 if some were.
# Any other errorcode will be treated as fatal.

資料來源:http://blog.tplus1.com/index.php/2007/08/29/how-to-use-vimdiff-as-the-subversion-diff-tool/



接下將 .svndiff_to_vimdiff 放在 ~ 底下



再於 ~/.cshrc 中加入 alias

alias svndiff 'svn diff \!* --diff-cmd ~/.svndiff_to_vimdiff'



從此就可以開心的使用 svndiff 指令取代 svn diff 摟!

example:

# svndiff file_path
# svndiff -r N:M file_path


Xdebug Profiler Tigger


http://www.example.com/testScript.php?XDEBUG_PROFILE=1


2011年11月8日星期二

SVN Diff 忽略空白


# svn diff 檔名 --diff-cmd `which diff` -x "-w"


2011年8月4日星期四

Windows WebDav 認證錯誤解決方法


NET USE * http://servername/fs/ password /USER:username


2011年6月29日星期三

tmux 解決 not a terminal 問題

直接下指令改目前設定

# sysctl net.inet.udp.maxdgram=65536
# sysctl net.local.stream.sendspace=8192


或者修改 /etc/sysctl.conf 將以上的設定值放進去,以後開機即自動生效。


2011年5月15日星期日

GDB trace PHP on Apache


#gdb /usr/local/sbin/httpd
run -X