2009-12-20

NS2 NSG2

http://sites.google.com/site/pengjungwu/nsg

在ns2.33中加入新的路由协议

http://hi.baidu.com/%D2%C1%C2%E4%B5%A4/blog/item/7352e9fa9b1b97d9b48f31f2.html

Abstract

ns2 is a discrete event simulator on networking systems, with development capability to add new network protocol models. To study algorithm enhancement or brand new protocol based on ns2, it's inevitable to implement the new algorithm or protocol. Here I discuss the work flow to add a flood routing protocol against ns2.33 specifically.

0. General Work Flow

The work flow is summarized as follows:
Implement the protocol in cpp source code
Modify ns2's cpp headers and tcl files to support and recognize the new protocol
Rebuild the whole ns2 package


1. Implement the New Protocol

1.1 The Flood Routing Protocol
The protocol is essentially a flood routing protocol whose working process is summarized as follows:

To prevent permanent route loop, sequencing is employed, dropping packets from a source node with past sequence number.
On receiving a packet, build a route entry for it in a fashion of {source_node, sequence_number}

The representation and operation of the route table is implemented in 2 C++ classes: MFlood_RTEntry and MFlood_RTable, in file mflood-seqtable.{cc, h}. While the process of the protocol itself is implemented in C++ class MFlood, in file mflood.{cc, h}.

Routine work for our packet type is done in mflood-packet.h.


1.2 Routine for otcl Hook

Though our protocol has been implemented in preceding steps, we have to make it play with the Split Object mechanism of ns2. For that we have to create a TCL class.

static class MFloodclass: public TclClass {
public :
MFloodclass() : TclClass ("Agent/MFlood") {}
TclObject * create(int argc, const char* const* argv) {
std::cout<<"*********running**************"< assert(argc==5);
return (new MFlood((nsaddr_t) atoi(argv[4])));
}
}class_rtProtocolMFlood;

For all agents in ns2, the TCL classes look similar to each other. In the code above, MFlood, the constructor of our routing agent, is involved to play together within the SplitObject hierarchy.

For a further discription of the TCL class, refer to Section 3.5 "Class TclClass" in The ns Manual.


2. Modify ns2's Headers and tcl Library to Recognize our New Agent

2.1 common/packet.h

Add packet type const and an element in class p_info's name_ array.

// insert new packet types here
static const packet_t PT_MFLOOD = 61;
static packet_t PT_NTYPE = 62; // This MUST be the LAST one


class p_info {
...

static void initName()
{
...
//mflood
name_[PT_MFLOOD] = "MFlood";

name_[PT_NTYPE]= "undefined";
}
};


2.2 tcl/lib/ns-packet.tcl

Add code to support mflood's packet header.

foreach prot {

...

# Routing Protocols:
#mflood
MFlood
NV # NixVector classifier for stateless routing
rtProtoDV # distance vector routing protocol
rtProtoLS # link state routing protocol
...

} {
add-packet-header $prot
}


2.3 tcl/lib/ns-lib.tcl

The instance procedure create-wireless-node of otcl class Simulator, is invoked when creating a wireless node. Here we have to add code to support our agent.

switch -exact $routingAgent_ {
MFlood {
set ragent [$self create-mflood-agent $node]
}
DSDV {
set ragent [$self create-dsdv-agent $node]
}

Do not forget to implement procedure create-mflood-agent, which is invoked in above code, somewhere in this otcl file.


Simulator instproc create-mflood-agent { node } {
set ragent [new Agent/MFlood [$node id]]
$node set ragent_ $ragent
return $ragent
}



2.4 Makefile

Find OBJ_CC, modify the piece of code as follows (at approximately Line 326):

The instance procedure create-wireless-node of otcl class Simulator, is invoked when creating a wireless node. Here we have to add code to support our agent.

wpan/p802_15_4trace.o wpan/p802_15_4transac.o \
apps/pbc.o \
src/mflood/mflood.o src/mflood/mflood-seqtable.o \
$(OBJ_STL)


3. Checklist of Related Files

Created source code and headers include:

mflood-packet.h
mflood-seqtable.h
mflood-seqtable.cc
mflood.h
mflood.cc


Modified ns2's exsiting files are:

common/packet.h
tcl/lib/ns-lib.tcl
tcl/lib/ns-packet.tcl
Makefile

For the modified files I've created a patch file that is available for download. To apply the patch, run

cd ns2
patch -p0 -b < mflood.patch


4. Rebuild the Whole ns2 Package

At the root path of ns2, run the following commands:

make
sudo make install

If you don't use 'sudo' in your Linux OS, run it with super user priviledge instead. For ns2-allinone package, just run the installation shell script again.


5. Run in a Typical Wireless Scenario

In this scenario, which consists of 3 wireless nodes, node0 cannot reach node2 directly. Instead node1 has to forward packets from node0 to node2. Below is a snippit of the trace. (otcl script download )

s 0.500000000 _0_ AGT --- 0 cbr 500 [0 0 0 0] ------- [0:0 2:0 32 0] [0] 0 0
r 0.500000000 _0_ RTR --- 0 cbr 500 [0 0 0 0] ------- [0:0 2:0 32 0] [0] 0 0
s 0.500000000 _0_ RTR --- 0 cbr 520 [0 0 0 0] ------- [0:0 2:0 30 0] [0] 0 0
r 0.504764500 _1_ RTR --- 0 cbr 520 [0 ffffffff 0 800] ------- [0:0 2:0 30 0] [0] 1 0
f 0.506526953 _1_ RTR --- 0 cbr 520 [0 ffffffff 0 800] ------- [0:0 2:0 29 0] [0] 1 0
r 0.511571453 _0_ RTR --- 0 cbr 520 [0 ffffffff 1 800] ------- [0:0 2:0 29 0] [0] 2 0
D 0.511571453 _0_ RTR LOOP 0 cbr 520 [0 ffffffff 1 800] ------- [0:0 2:0 29 0] [0] 2 0
r 0.511571787 _2_ AGT --- 0 cbr 520 [0 ffffffff 1 800] ------- [0:0 2:0 29 0] [0] 2 0

From the trace above, we can see that node0 sends a packet out.
node0 receives a copy of the packet itself before the IP header is added (note the packet size).
node1 receives the packet and forwards it.
As a result, node0 receives it again and drops it immediately.
Finally node2, the real destination, receives it.

And we can find out, that the end to end delay from its origination to destination for this packet, is 0.511571787 - 0.5 = 0.011571787 (s) ~= 11.6 (ms)

Each packet is 500*8 bits, so a transmission delay is 500*8/2E6 = 2 (ms). And there's a random forward delay of 10ms (see mflood.h).
These are the 2 main contributors to the total delay.


6. Future Work

Run more detailed and complex scenarios using this protocol/agent. Add some interesting features for this protocol.




Biblography

[Web] Ros, F.J. and Ruiz, P.M. "Implementing a New Manet Unicast Routing Protocol in NS2 ".http://masimum.dif.um.es/nsrt-howto/html/nsrt-howto.html
[Web] Ke, C.H. "如何使得MFLOOD可以在ns-2.27的環境下運作". http://140.116.72.80/%7Esmallko/ns2/mflood.htm
[Book] 徐雷鸣. 等. "ns与网络模拟" 人民邮电出版社, 2003

如何往NS2中添加新的MAC协议

http://www.baisi.net/thread-4031-1-1.html

原创-----如何往NS2中添加新的MAC协议

网上有关于往NS2中添加新的路由协议的文章,却没有关于往NS2中添加新的MAC协议的文章。下面我给大家讲一下如何往NS2中添加新的MAC协议。
往NS2.29中添加了一个新的MAC协议,暂时命名为LMAC.其实它的代码内容和SMAC一样,我只是想验证一下如何在NS2.29中添加新的协议。
1.在~/ns-allinone-2.29/ns-2.29/mac目录下copy原来的smac.cc和smac.h
cp smac.cc lmac.cc
cp smac.h lmac.h

2.打开lmac.cc和lmac.h,把所有的SMAC替换成LMAC,把所有的smac替换成lmac,把所有的Smac替换成Lmac.

3.修改packet.h
打开packet.h,找到匹配字符串SMAC,然后照着样子修改就可以了。
packet.h在~/ns-allinone-2.29/ns-2.29/common目录下
添加定义访问协议报头的指针
#define HDR_SMAC(p) ((hdr_smac *)hdr_mac::access(p))
#define HDR_LMAC(p) ((hdr_lmac *)hdr_mac::access(p)) // add lmac here
增加LMAC包类型(协议标志),所有的包类型都是PT_开头,如PT_TCP,PT_UDP等,在枚举类型enum packet_t{}中找到 PT_SMAC,
添加LMAC
// SMAC packet
PT_SMAC,
// LMAC packet
PT_LMAC,
注意新添加的协议要在PT_NTYPE之前。
然后在类class p_info{}的构造函数中找到
name_[PT_SMAC]="smac";
添加 name_[PT_LMAC]="lmac";这样就可以通过协议标识寻找协议对应的字符串
同样注意要在 name_[PT_NTYPE]= "undefined";之前定义

4.修改ns-default.tcl文件,在~/ns-allinone-2.29/ns-2.29/tcl/lib目录下
找到
# Turning on/off sleep-wakeup cycles for SMAC
Mac/SMAC set syncFlag_ 1
# Nodes synchronize their schedules in SMAC
Mac/SMAC set selfConfigFlag_ 1
# Default duty cycle in SMAC
Mac/SMAC set dutyCycle_ 10
这里定义了otcl对象的缺省值,我们在这里添加LMAC的缺省值
#add LMAC here
# Turning on/off sleep-wakeup cycles for LMAC
Mac/LMAC set syncFlag_ 1
# Nodes synchronize their schedules in LMAC
Mac/LMAC set selfConfigFlag_ 1
# Default duty cycle in LMAC
Mac/LMAC set dutyCycle_ 10

继续寻找SMAC,找到
# Turning on/off sleep-wakeup cycles for SMAC
Mac/SMAC set syncFlag_ 0
添加相应的LMAC
# Turning on/off sleep-wakeup cycles for LMAC
Mac/LMAC set syncFlag_ 0

5.修改ns-packet.tcl文件,在~/ns-allinone-2.29/ns-2.29/tcl/lib目录下
在foreach prot{}这个函数中找到Smac,
Smac # Sensor-MAC
添加一行: Lmac # A new Sensor-MAC

6.修改Makefile文件,在~/ns-allinone-2.29/ns-2.29/目录下
找到smac.o
mac/mac-802_3.o mac/mac-tdma.o mac/smac.o \
添加lmac.o到ns的目标文件列表:
mac/mac-802_3.o mac/mac-tdma.o mac/smac.o mac/lmac.o\

7.经过以上几步,一个新的协议就一经添加成功了,但是这个新的LMAC协议产生的trace文件格式不正确,
还要修改cmu-trace.cc和cmu-trace.h文件,在~/ns-allinone-2.29/ns-2.29/trace目录下
修改cmu-trace.h文件,找到这一行:
void format_smac(Packet *p, int offset);
增加一行:
void format_lmac(Packet *p, int offset);
然后修改cmu-trace.cc文件,这个文件是修改的关键!!
在void
CMUTrace::format_mac_common(Packet *p, const char *why, int offset)
这个函数中修改,添加进去LMAC
struct hdr_cmn *ch = HDR_CMN(p);
struct hdr_ip *ih = HDR_IP(p);
struct hdr_mac802_11 *mh;
struct hdr_smac *sh;
struct hdr_lmac *ph; // 新添加一个指向lamc包的指针
char mactype[SMALL_LEN];
strcpy(mactype, Simulator::instance().macType());
if (strcmp (mactype, "Mac/SMAC") == 0)
sh = HDR_SMAC(p);
else if (strcmp (mactype,"Mac/LMAC") == 0) // 判断是不是LMAC包,新添加的语句
ph = HDR_LMAC(p);
else
mh = HDR_MAC802_11(p);
继续往下找SMAC,添加LMAC

if (strcmp (mactype, "Mac/SMAC") == 0) {
format_smac(p, offset);
}
else if (strcmp (mactype, "Mac/LMAC") == 0) { //新添加的语句
format_lmac(p, offset);
}
else {
format_mac(p, offset);
}
return;

在if(newtrace){}的判断语句中找到SMAC

// mac layer extension
offset = strlen(pt_->buffer());
if (strcmp(mactype, "Mac/SMAC") == 0) {
format_smac(p, offset);
}
else if (strcmp(mactype, "Mac/LMAC") == 0) { //新添加的语句
format_lmac(p, offset);
}
else {
format_mac(p, offset);
}
继续找SMAC,找到:

(ch->ptype() == PT_SMAC) ? (
(sh->type == RTS_PKT) ? "RTS" :
(sh->type == CTS_PKT) ? "CTS" :
(sh->type == ACK_PKT) ? "ACK" :
(sh->type == SYNC_PKT) ? "SYNC" :
"UNKN") :
packet_info.name(ch->ptype())),
ch->size());
添加LMAC的判断
(ch->ptype() == PT_SMAC) ? (
(sh->type == RTS_PKT) ? "RTS" :
(sh->type == CTS_PKT) ? "CTS" :
(sh->type == ACK_PKT) ? "ACK" :
(sh->type == SYNC_PKT) ? "SYNC" :
"UNKN") :
(ch->ptype() == PT_LMAC) ? ( //这一块代码是新添加的
(ph->type == RTS_PKT) ? "RTS" :
(ph->type == CTS_PKT) ? "CTS" :
(ph->type == ACK_PKT) ? "ACK" :
(ph->type == SYNC_PKT) ? "SYNC" :
"UNKN") :
packet_info.name(ch->ptype())),
ch->size());
这里要好好看看源代码,看清楚程序的结构,不要添加错了
再继续找,添加LMAC
if (strncmp (mactype, "Mac/SMAC", 8) == 0) {
format_smac(p, offset);
}
else if (strncmp (mactype, "Mac/LMAC", 8) == 0) { //新添加的代码
format_lmac(p, offset);
}
else {
format_mac(p, offset);
}
再往下找,找到这个函数:
void
CMUTrace::format_smac(Packet *p, int offset)
{
struct hdr_smac *sh = HDR_SMAC(p);
sprintf(pt_->buffer() + offset,
" [%.2f %d %d] ",
sh->duration,
sh->dstAddr,
sh->srcAddr);
}
照着样子给LMAC写一个相同功能的函数:
void
CMUTrace::format_lmac(Packet *p, int offset)
{
struct hdr_lmac *ph = HDR_LMAC(p);
sprintf(pt_->buffer() + offset,
" [%.2f %d %d] ",
ph->duration,
ph->dstAddr,
ph->srcAddr);
}

然后找到void CMUTrace::format(Packet* p, const char *why)这个函数
添加
switch(ch->ptype()) {
case PT_MAC:
case PT_SMAC:
case PT_LMAC: //这是新添加的LMAC协议
break;
case PT_ARP:
format_arp(p, offset);
break;
最后在文件的开头找到#include
添加#include
到此为止,协议添加完成

8.回到目录~/ns-allinone-2.29/ns-2.29下,执行命令:
make clean
make depend
make
make结束后运行,发现报错,说smac.h和lmac.h有函数重定义了,这是因为cmu-trace.cc文件同时include了smac.h和lmac.h,
所以当smac.h和lmac.h有相同名字的定义时,就会报错,解决方法是把lmac.h中与smac.h重名的类改成其它名字,当然在lmac.cc中要做相应的修改。

9.如何评价新的协议是否添加成功?
在添加新的协议之前,我一经运行了ns smac.tcl,把smac.tr文件备份为smac.tr.bak。添加了新的协议后,我重新运行ns smac.tcl,得到新的smac.tr文件,然后我执行命令
diff -b smac.tr smac.tr.bak
发现这两个文件内容一模一样,说明原来的协议SMAC运行正常。
然后我修改了smac.tcl,命名为lmac.tcl,调用LMAC协议,然后执行命令ns lmac.tcl,产生trace文件lmac.tr
执行命令
diff -b smac.tr lmac.tr
发现这两个trace文件的内容是一样的,这说明LMAC协议添加成功了,耶~~~~~~~~~~~~~~~~~~~~

10.在添加新的协议中注意的一些问题和相关技巧:
添加一个新的协议,要照着原来协议的方法写。其实最简单的方法是把含有SMAC,smac,Smac字符串的文件都找出来,然后照样子添加LMAC协议就可以了。
~/ns-allinone-2.29/ns-2.29/gen下的文件是make的时候自动生成的,不用修改
在~/ns-allinone-2.29/ns-2.29/tcl/lib下,文件ns-lib.tcl也含有SMAC的内容,主要是在tcl调用smac时大印出警告语句,告诉用户SMAC要40秒后才能同步。这个文件可以修改,也可以不修改,对运行结果(trace文件)没有影响。


-----------------------------
QQ:631305143
MSN:gmchen@hotmail.com
EE
Fudan University && Shanghai Jiao Tong University
avid
Research Fields: MAC Protocol in WSN, Cross Layer Optimization

NS2 new trace format

###### event type (事件類型) ######
$1 ==> event [s: send(傳送); r: receive(接收); d:drop(丟棄); f: forward(轉送)]

###### general flag ######
$2 ==> -t
$3 ==> 時間

###### Next hop info (下一站的資訊) ######
$4 ==> -Hs
$5 ==> id for this node

$6 ==> -Hd
$7 ==> id for next hop towards the destination

###### Node property type tag (節點屬性類型標籤) ######
$8 ==> -Ni
$9 ==> node id (節點ID)

$10 ==> -Nx
$11 ==> node's x coordinate (節點的x座標位置)

$12 ==> -Ny
$13 ==> node's y coordinate (節點的y座標位置)

$14 ==> -Nz
$15 ==> node's z coordinate (節點的z座標位置)

$16 ==> -Ne
$17 ==> node energy level

$18 ==> -Nl
$19 ==> trace level [AGT: Agent trace ; RTR: Router trace; MAC: Mac trace]

$20 ==> -Nw
$21 ==> reason for the event (事件發生原因)

###### packet info at MAC level (封包在Mac層的資訊) ######
$22 ==> -Ma
$23 ==> duration

$24 ==> -Md
$25 ==> dest's ethernet address

$26 ==> -Ms
$27 ==> src's ethernet address

$28 ==> -Mt
$29 ==> ethernet type

###### Packet information at IP level (封包在IP層的資訊) ######
$30 ==> -Is
$31 ==> source address.Source port number (來源位置,a.b其中a為節點ID,b為埠號)

$32 ==> -Id
$33 ==> dest address.dest port number (目的位置,c.d其中c為節點ID,d為埠號)

$34 ==> -It
$35 ==> packet type (封包類型)

$36 ==> -Il
$37 ==> packet size (封包大小)

$38 ==> -If
$39 ==> flow id (資料流ID)

$40 ==> -Ii
$41 ==> unique id (唯一的ID編號)

$42 ==> -Iv
$43 ==> ttl value (Time To Live的值)

###### Packet info at Application level(封包在應用層的資訊) ######
包含的應用程式類型如arp, tcp或者是adhoc路由協定像是DSDR, DSR, AODV等等。
這個欄位都是以P所開頭的,且標籤為隨著應用程式不同而不同。

r -t 29.994272667 -Hs 3 -Hd -2 -Ni 3 -Nx 70.00 -Ny 50.00 -Nz 0.00 -Ne -1.000000 -Nl MAC -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0

2009-12-17

仙劍奇俠傳三 (電視劇)

曲目曲名演唱類型
1.生生世世愛吳雨霏片頭曲
2.忘記時間胡歌片尾曲
3.此生不換青鳥飛魚插曲
4.光棍胡歌插曲
5.答應不愛你鄭中基插曲
6.偏愛張芸京插曲
7.我做我的王[9]兄弟聯插曲
8.你是我一首唱不完的歌郭蘅祈插曲
9.降魔劍
配樂
10.雪見 — 仙凡之旅
配樂
11.共伴闖天涯
配樂
12.景天 — 護甲
配樂
13.長卿 — 眾生平等
配樂
14.龍葵 — 千年等待
配樂

2009-12-15

NS2 LL (link-layer) Class

14.6 LL (link-layer) Class

The link-layer object is responsible for simulating the data link protocols. Many protocols can be implemented within this
layer such as packet fragmentation and reassembly, and reliable link protocol.
Another important function of the link layer is setting the MAC destination address in the MAC header of the packet. In the
current implementation this task involves two separate issues: finding the next–hop–node’s IP address (routing) and resolving
this IP address into the correct MAC address (ARP). For simplicity, the default mapping between MAC and IP addresses is
one–to–one, which means that IP addresses are re–used at the MAC layer.

VII. A new protocol for ns

NS2 如何傳送一個封包(How to transmit a packet?)

2009-11-22

SkyDrive Explorer 輕鬆瀏覽、下載、上傳SkyDrive網路硬碟(25GB免費空間)

clipped from briian.com

第1步  將SkyDrive Explorer軟體下載回來並安裝好之後,不用做任何設定,也沒有啥軟體視窗或介面,直接開啟「我的電腦」視窗,我們可以看到在一般的磁碟機、光碟機的圖示之外,多出了一個「SkyDrive Explorer」的圖示,請直接按兩下開啟它。

01-SkyDrive Explorer 輕鬆瀏覽、下載、上傳SkyDrive網路硬碟(25GB免費空間)

 

第2步  第一次使用時,如果尚未登入SkyDrive的話會出現一個長得很像MSN聊天軟體的登入視窗(但它不是聊天用的),請輸入你的Windows Live ID或MSN聊天帳號、密碼,按下「Sign In」後,就可以登入微軟提供給你的免費25GB網路硬碟空間。

02-SkyDrive Explorer 輕鬆瀏覽、下載、上傳SkyDrive網路硬碟(25GB免費空間

 

第3步  登入SkyDrive之後,我們可以看到「SkyDrive Explorer」磁碟機中預設會有幾個資料夾,這些就是SkyDrive網頁上的那些文件、我的最愛、公開...等等資料夾。

如果你的檔案上傳之後想分享給朋友下載的話,請將檔案上傳到「公開」資料夾中,不想被人看到的檔案,請不要放在有公開或Public之類字樣的資料夾裡。(另外我們也可新增資料夾並設定瀏覽權限)

03-SkyDrive Explorer 輕鬆瀏覽、下載、上傳SkyDrive網路硬碟(25GB免費空間

 

第4步  我們可以依照自己的使用需求,將檔案上傳到SkyDrive的資料夾中,只要像平常複製檔案時的操作方式來做就可以了,就是用滑鼠把檔案拖拉到SkyDrive資料夾中即可上傳上去囉。要下載某個檔案的話,一樣是用滑鼠拉到桌面就好。

04-SkyDrive Explorer 輕鬆瀏覽、下載、上傳SkyDrive網路硬碟(25GB免費空間

 

第5步  上傳之後,我們可以開啟Windows Live SkyDrive網頁,看到剛剛上傳的圖片已經顯示在SkyDrive網頁上囉。

05-SkyDrive Explorer 輕鬆瀏覽、下載、上傳SkyDrive網路硬碟(25GB免費空間

 

第6步  另外,如果你把檔案上傳到公開的資料夾,可讓一般使用者下載的話,我們可以在SkyDrive Explorer資料夾中上傳完成後,在已上傳的檔案上按右鍵,再點「Copy URL to the Clickboard」,即可將此檔案的下載網址複製出來。

我們只要將這個檔案的網址貼到部落格、Email,或用MSN貼給你的朋友,大家就可直接在SkyDrive網站下載你所分享的檔案囉。

06-SkyDrive Explorer 輕鬆瀏覽、下載、上傳SkyDrive網路硬碟(25GB免費空間 

 blog it

The Will Will Web 記載著 Will 在網路世界的學習心得與技術分享 介紹好用工具:SQLDumper ( 匯出 SQL Server 資料的好物 )

clipped from blog.miniasp.com

早在去年我寫過一篇【將資料庫表格中的資料以 INSERT INTO 指令的方式匯出】文章,但這個方式有個缺點是當一筆紀錄的資料量超過 8KB 時就沒辦法使用了,之後這個方式我也很少用,而改用另一套更加完善的 SQL Dumper 工具,介面簡單、功能實用且強大,絕對是在做資料轉移時不可多得的好工具!

SQL Dumper

SQL Dumper 有幾像我覺得十分獨特的特色:

  1. 同時支援 Console 與 Windows 工具,可在指令列下執行預先設定好的匯出任務
  2. 自動切割大型資料表格所匯出的資料,只要一個 SQL 檔大於 50MB 就會自動切割
  3. 當匯出多張表格資料且資料間有關連限制(Foreign Key Constrain)時,會自動判斷匯出資料的順序
  4. 支援自我關連(Reference to itself)的表格類型,可決定資料匯出順序,以確保資料可一次匯入成功
  5. 確保輸出的 Primary Key IDENTITY 資料與最後匯入的 Primary Key IDENTITY 資料一致
  6. 可以自訂 SELECT 查詢條件決定輸出資料的範圍 (非常彈性)

以下是使用上幾點需注意的事項:

1. 若有設定 [Output Settings] 且不指定 [Set output file name] 時預設輸出的檔名為 資料庫名稱.sql

2. 若有設定 [Set output file name] 時僅需輸入「檔案名稱」的部分即可,無須設定 .sql 副檔名

SQL Dumper :: [Output Settings]

3. 若使用 T-SQL 輸出時,請務必設定 Table Name in SQL Statement 欄位!

SQL Dumper 自訂輸出條件 

3. 若要使用 SQL Dumper Console 程式,必須先利用 Windows 工具先將所有條件設定好,最後利用 [File] –> [Save Settings] 功能將 XML 設定檔匯出,操作範例如下圖示:

SQL Dumper

SQLDumperConsole.exe

我想其他功能也很容易,應該不用贅述,自己嘗試幾次應該就會用了。

相關連結

 blog it

2009-11-21

/dev/null: Permission denied



The problem seems to be with the permissions of
the /dev/null. This seems to be read only at the
moment for you. Check this by logging in as root
and listing it with the command:
ls -l /dev/null
You should see this if everything is correctly
set:
crw-rw-rw- 1 root root 1, 3

If you get a different set of permissions like
this maybe:
-rw-r--r-- 1 root root 1, 3

then you should (as root) delete the /dev/null with:
rm /dev/null

and recreate it (as root) again with:
mknod -m 0666 /dev/null c 1 3

(The device number according to the Kernel source
in the documentation under Documentation/devices.txt
supposed to be Major=1 und Minor=3)

Now, list the /dev/null again and you should see
the permissions as above. Hope this helps..

linux squid

su nobody -c "/usr/local/squid/bin/RunCache &"

vi /usr/local/squid/etc/squid.conf

/usr/local/squid/sbin/squid -k reconfigure

linux mandrake (mandriva) urpmi

urpmi.removemedia -a

urpmi.addmedia --distrib --mirrorlist 'ftp://ftp.twaren.net/Linux/Mandrake/official/2010.0/i586'

urpmi --auto-select --auto

urpme --auto-orphans

2009-11-10

成語故事﹕尸位素餐

clipped from www.epochtimes.com
「尸位素餐」的英譯是﹕
To neglect the duties of an office while taking the pay. 或者是 Redundant personnel

尸音史,是古代祭禮中的一個代表神像端坐看而不須要做任何動作的人。《書經》有道:「太康尸位。」尸位就是源出於此,用來比喻一個有職位而沒有工作做的人,正如祭禮中的尸,只坐在位上,不必做任何動作一樣。

「素餐」也是出於《詩經》:「彼君子兮,不素餐兮。」後人於是用「素餐」來比喻無功食祿的人。

把「尸位」和「素餐」兩者連合成為一句成語,應該說是出於《漢書》,因為《漢書》的《朱雲傳》裹:「今朝廷大臣,上不能匡主,下亡以益民,皆尸位素餐。」整句成語的意思,也是和上述的尸位和素餐相同。這樣說,我們要研究成語的出處,對這句成語分合的出處,也應該詳細知道。

一般機關、社團、商店的冗員,憑看人事或其他特殊的關係,只知道每月按期領取薪金,每日吃喝閑坐,而不做任何工作,這種人都可以說是「尸位素餐」。此外,一般工作能力很差的人,雖然已經盡了自己的能力服務,但事情總是做不好,毫無成積可言,這種人能夠保持職位,不是靠自己的本領,而是藉著特殊關係,因此也可以說「尸位素餐」。

又如某人向朋友說,自己本來沒有甚麼本領,幸蒙東主的照顧,得到解決生活,但自己「尸位素餐」,良心上也有點內疚。這樣說,又成為很得體的謙話了。

 blog it

2009-11-08

台灣房地產買賣價格、交易行情調查表

clipped from briian.com
  • 網站名稱:內政部地政司全球資訊網 房地產交易價格
  • 網站網址:按這裡
  • 交易價格資料來源:各直轄市、縣市政府所轄地政事務所就稅捐機關移送之土地現值申報書內買賣及公地標售案件,派員向當事人、不動產經紀人、地政士、交易案例四鄰、公有土地管理機關等調查土地及建物之買賣、標售資料。本房地產交易價格資料僅供參考。


  •  

    查詢當地新成屋、中古屋買賣行情的方法:


    第1步  開啟網頁之後,有「圖形模式」與「文字模式」兩種方式可查詢,圖形模式的話可以直接在台灣地圖上的縣市名稱按一下,就可以查詢當地的房地產交易資訊。

    01-台灣房地產買賣價格、交易行情調查表

     

    第2步  文字模式的話則可依照縣市、交易類別、季別與街道名稱、使用分區、店面住宅或工具...等等各種方式來篩選你要的資訊。

    02-台灣房地產買賣價格、交易行情調查表

     

    第3步  如果是用「圖形模式」按進去,會用更細的鄉、鎮、區地圖讓我們挑選要查詢的資料。

    03-台灣房地產買賣價格、交易行情調查表

     

    第4步  按進去之後會用表格的方式將當季的成交價格與街道名稱、完工年月、樓層總數、坪數與售價...等等資料全部列出來,只要用這網站查尋一下,想知道哪個地段的房地產行情與相關資訊就方便多囉。

    04-台灣房地產買賣價格、交易行情調查表

     blog it

    用Google翻譯變出雙語版部落格!

    clipped from www.techbang.com.tw

    為部落格加入翻譯小工具


    Step 1

    Google翻譯也有提供部落格小工具,透過翻譯小工具網址可以取得HTML碼。
    PC Home No.163 Dr. J

    Step 2

    這裡以Pixnet為例,進入後台後選擇「側邊欄位設定」,點選右側的「新增版位」。PC Home No.163 Dr. J

    Step 3

    接著輸入欄位標題,最好標明Translate讓別人知道是翻譯使用,並且貼上HTML碼。PC Home No.163 Dr. J

    Step  4

    然後將建立好的欄位從右側拖放到你所要放的空間,建議放在醒目的位置上。

    PC Home No.163 Dr. J

    Step 5

    到部落格首頁後就能看到翻譯小工具,透過下拉式選單可以直接翻譯成各國語言。PC Home No.163 Dr. J

     blog it

    簡報極簡主義:2個得獎優秀簡報分析(三)

    clipped from www.techbang.com.tw

    科技類簡報首獎:24 Reasons why Twitter sucks!

    作者:Henrico Dolfing

    這個簡報用到大量的「留白」技巧,這對於國內的傳統簡報來說,可能會相當不能接受。因為受過傳統教育的我們,總會覺得留白是一種罪惡,想盡辦法把空白處要填滿。

    實際上版面的留白是用來提供一個透氣的視覺空間,用來導引讓觀看者視覺能夠集中。留白的適當,可以讓文字或是圖片之間有層次輕重之分,提供最直覺的閱讀感受。

    值得注意的是,留白不一定就是白色,你也可以「留黑」,用黑底白字來營造效果,但黑底白字給人的感覺會比較沈重。另外,就算是同樣的文字內容,同樣的字體,相同的兩張投影片放在那裡,採用「留黑」設計的投影片,總會比採用「留白」的投影片首先吸引到人的目光。

    注意「24 Reasons why Twitter sucks!」某些投影片有同時「留白」與「留黑」的設計,比較重要的字詞總是放在「留黑」的那一塊。

    Business類首獎:Eco-nomics, The hidden costs of consumption

    作者:Joshua Beatty


    在簡報中引用圖表或是數據在所難免,但我們常常在一些行銷會議或是趨勢說明會中,看到一大張密密麻麻的表格,然後搭配五顏六色的折線圖,演說者告訴你從圖表上可以看出從第一季到第三季公司的成長多少,然後淨利多少,這些是從哪些消費者得來的……但是你看著那密密麻麻的圖表,卻什麼都看不出來。

    這種簡報最大的問題就在於,圖表也需要整理。你不能直接將公司的損益平衡表COPY到簡報上,因為沒有多少人看得懂這麼複雜的圖表,一張投影片也無法說明這麼多的事情。就像文字轉換到投影片上需要簡化一樣,圖表在投影片上呈現的時候,也應該要簡單化。

    「The hidden costs of consumption」,以清晰易懂的方式將圖表簡單化。一開始以說故事的方式,說明一個普通美國人,他一年的花費有多少,其中又有多少社會的「隱藏成本」。整個流程採用說故事的方式,在其中最難的隱藏成本的數字說明卻淺顯易懂。

     blog it

    簡報極簡主義:讓簡報架構綱舉目張(二)

    clipped from www.techbang.com.tw

    字體的選用保持簡單


    由於極簡主義強調簡單的文字搭配簡單的圖片,多數的投影片上往往只有簡單的幾個字,那麼,選擇什麼字型,就變得相當重要。

    西方研究字體有其一套系統,他們將字體主要分為serif 及 sans serif兩大類。Serif字體在筆畫上有比較多的裝飾,例如常用的「Times New Roman」字型就是屬於這種字體。而sans serif則是沒有裝飾的字體,例如「Arial」字型。

    目前主流認為投影片的字體應該選擇簡單沒有裝飾的字體,整體線條粗細平均,對觀眾來說識別最清晰省力。以中文來說,黑體、正黑體都是屬於沒有裝飾的字體。而像是細明體、標楷體,就是屬於有裝飾的字體,應該要避免。

    pp04

    ▲上方為裝飾性的字體,筆劃的末端都有裝飾性的筆頓。而下方字體則粗細一致。

    pp05

    ▲標楷體為裝飾性的字體,正黑體則為非裝飾性字體。

    條列簡單,才記得住


    我們在學校的時候,老師常常說要「列出重點」,鼓勵我們用條列式的方式進行簡報。於是,我們就會製作出類似這樣的簡報內容:


    1. 文字落落長。

    2. 大項標完還有小項。

    3. 數字標完不夠用,還加上甲乙丙丁。

    4. 一張投影片列出十幾個重點。

    5. 為了怕都是字太難看,還加上小花圖案在投影片上點綴。


    這種內容是條列式嗎?其實這只是將你要說的一句話,拆分成五句話而已。看起來像是條列式,但是每一項都不會有人記得住。與條列式比較起來,我們還有更多更簡潔而且方便的表現方式。

    如果你還是習慣用條列式,那麼最起碼要記住,在同一張投影片中出現的條列項目,最好不要超過六項。如果超過這個數量,寧可將主題再加以切分,多用幾張投影片介紹,也比同一張投影片裡頭出現一長串的條列來得好很多。

    sample02
    ▲這是由坊間教科書所附的教學光碟中抽出的一頁投影片,典型的傳統式條列法。

    SAMPLE02B
    ▲如果投影片內容過多,不妨將內容再細分切割為多張投影片。

     blog it

    簡報極簡主義:提高簡報的可讀性(一)

    clipped from www.techbang.com.tw

    頁面簡單,投影片變好看


    在製作投影片時,最重要的要點就是要把握頁面的「簡單」。

    觀眾來聽演說,主要是聽「你」要傳遞的訊息,或是聽取有用的資訊。你不需要將這些訊息全部放在投影片上。投影片的作用是用來輔助演講人的進行,而不是當成演說的小抄。事前將演說的內容先牢記在心是對觀眾基本的尊重,投影片的內容僅是用來對你要說的主題畫龍點睛。。

    甚至有此一說,認為最好的簡報,是從頭到尾沒有任何一個文字的簡報,因為該說的都留給你自己去表達,簡報只要提供輔助的圖表即可。或許這樣的簡報又太過於矯枉過正了,不過也值得參考。

    pp01
    ▲不超過一行的簡單文字搭配底圖,是實行極簡主義的第一步。

    注意留白


    要讓頁面簡單,最好的方式就是留白。

    很多人看到投影片上的空白就感到有罪惡感,很想用文字或是圖片、表格將它填滿。你應該要捨棄這樣的習慣。你的每一張投影片應該要有大量的「空間」,也就是留白的地方。這在英文有個專有名詞叫做「white space」或是「negative space」。

    投影片不是書本,每一張投影片保留在螢幕上的時間都不長,當一張新的投影片切換出來,整張滿滿的都是字,你一定會有眼睛不知道該從何看起的困擾。而如果投影片上有大量的留白,只有主要的訊息停留著,這樣印象會比都是字的情況來得深刻許多。在投影片上提供的訊息越少,觀眾就越能將心力集中在你要提供的訊息上。

    另外,雖然同樣是「留白」,字體的大小以及你是留「白」還是留「黑」,都會帶給觀看者不同的感受。一般而言,字體越大,留白越少,心理上的壓迫感也越重。

    pp02 pp03
    ▲同樣的文字,留白的空間以及色彩選用的不同,給人完全不同的感受。

    (待續)

     blog it

    Photo Story 3:串起圖片說故事

    clipped from www.techbang.com.tw
    • 軟體名稱:Photo Story 3 for Windows

    • 語言介面:中文

    • 購買金額:免費

    • 下載網址:tinyurl.com/7yxj8



    ▲1. 圖片預覽及快速調整
    ▲2. 所有欲串連的圖片縮圖
    ▲3. 即時儲存串連的圖檔
    ▲4. 一步步進行特效、文字、旁白設定

    串聯靜態照片


    Step 1

    完成安裝初次啟用時,首先選擇「開始新故事」。

    note:認證正版Windows
    安裝Photo Story 3 for Windows前,必須先完成Windows的正版認證,並安裝Windows Media Player 10以上的版本後,才能順利安裝及使用。

    Step 2

    按下「匯入圖片」選項,再於電腦中找尋欲串連播放的圖片。

    Step 3

    完成圖片的匯入後,還能選擇旋轉、除紅眼等設定,或按下「編輯」進行進階特效。

    note:圖片編輯功能
    Photo Story 3 for Windows提供的圖片編輯功能有基本的「旋轉和裁剪」,以及調整亮度、對比、消除紅眼的「自動修正」,而「新增特殊效果」則是可改變整張圖片呈現效果的設定。

    圖片特效設定


    Step 1

    於「新增特殊效果」裡,可運用水彩、負片、彩色鉛筆等多種特效。

    Step 2

    接著進行圖片文字的輸入,可用來說明圖片或增加趣味性,在此亦提供簡單的文字位置調整。

    Step 3

    進入下一步則可選擇是否加入語音旁白,為圖片進行解說,最後再按下「自訂動作」。

    Step 4

    點選「轉換」的標籤頁,可選擇圖片轉換的方式,及設定每張圖片播放的時間。

    note:設定啟始圖片及時間
    在「動作和持續時間」的標籤頁裡,可用來設定一連串圖片的啟始位置,並提供了隨時「預覽」效果的功能。

    Step 5

    接著可由「選取音樂」及「建立音樂」處,為這個串連的圖片選擇背景音樂,再按下一步。

    Step 6

    選擇在何處播放串連的圖片檔時,也可順便調整解析度,讓檔案不至於過大。

    note:完成的檔案存放位置?
    最後完成的檔案,會以WMV的檔案格式儲存在My Documents的My Videos資料夾裡,若選擇「儲存專案」則會以副檔名為wp3的格式儲存於同一個地方,日後想要修改,就可直接點選檔案開啟。

    Step 7

    完成上述設定後,按下「檢視故事」就可在Windows Media Player 10上播放。

     blog it