Time of Update: 2018-12-07
我用以下的方式安裝libpcap,./configuremakemake install並且用下面的代碼測試:#include <stdio.h>#include <stdlib.h>#include <pcap.h>int main( int argc, char** argv ){ char *dev, errbuf[PCAP_ERRBUF_SIZE]; dev = pcap_lookupdev( errbuf );
Time of Update: 2018-12-07
/** author: lx date 4.11 2011 biref BN*/#pragma once#include <string>#include <map>#include <vector>#include <iostream>using namespace std;typedef pair< char, float > inter;/* struct of node */struct nbnode{char name[20]
Time of Update: 2018-12-07
代碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include <sys/socket.h>#include <string.h>#include <netinet/in.h>#include <errno.h>int main(int argc, char** argv){int s, con;
Time of Update: 2018-12-07
由於論文中會用到NS2軟體,重來沒有用過,現在嘗試在Linux下安裝NS2軟體,安裝的步驟總結如下:1. 下載NS2的軟體包:wget http://sourceforge.net/project/showfiles.php?group_id=149743&package_id=169689&release_id=588643(這個網址我沒試過)2. 解壓下載的軟體包: tar zxvf ns-allinone-2.33.tar.gz 3. 找到解壓後的檔案:cd
Time of Update: 2018-12-07
Ubuntu下安裝samba伺服器:步驟1:Ubuntu下安裝samba #apt-get install samba #apt-get install smbfs步驟2:添加linux使用者 #useradd user1 //添加使用者名稱user1 #passwd user1 //給使用者名稱user1添加密碼 #mkdir /home/user1 //建立user1的home目錄,如果不用這個使用者名稱來登陸linux,此步驟不是必需
Time of Update: 2018-12-07
#__author__=lx#__date__=2011-10-03#__brief__=BFSfrom collections import dequedef BFS( G, s ): d = [] color = [] p = [] L = deque() for i in range( len( G ) ): if i != s:
Time of Update: 2018-12-07
#include <stdlib.h>#include <stdio.h>intmain( int argc, char** argv ){ int i = 0; for ( ; i < argc; i++ ) { printf( "argv[%d] is %s\n", i, argv[i] ); } int arg_c = argc; char**
Time of Update: 2018-12-07
先貼會有用的相關內容:struct iphdr {#if BYTE_ORDER == LITTLE_ENDIAN uint8_t ihl:4, version:4;#elif BYTE_ORDER == BIG_ENDIAN uint8_t version:4, ihl:4;#else# error "BYTE_ORDER must be defined"#endif uint8_t tos; uint16_t tot_len;
Time of Update: 2018-12-07
/* * author: lx * date: 2011-09-16 * brief: programming pearls column2 */#include <stdio.h>#include <stdlib.h>voidmove_vector( char* b, int m, int n ){ int i = 0; int j; char temp; for ( ; i < n ; i++ )
Time of Update: 2018-12-07
N = 4;dag = zeros( N, N );C = 1; S = 2;R = 3;W = 4;dag( C, [R S] ) = 1;dag( R, W ) = 1;dag( S, W ) = 1;node_sizes = 2*ones(1,N);%node_sizes = [ 4 2 3 5];%建立有向非循環圖onodes = [];bNet = mk_bnet( dag, node_sizes );%建立條件機率表bNet.CPD{C} = tabular_CPD( bNet,
Time of Update: 2018-12-07
貝葉斯學習演算法應用於機器學習的有兩個原因,第一:貝葉斯學習能夠計算顯式的假設機率,如樸素貝葉斯分類器。第二:貝葉斯方法為理解機器學習的其他方法提供了手段,如分析FIND-S演算法。 貝葉斯法則對與貝葉斯學習至關重要,其形式如下: 貝葉斯法則提供了一種計算假設機率的方法,它基於假設的先驗機率、給定假設下觀察到不同資料的機率以及觀察到的資料本身。其中P(H)用來代表在沒有訓練資料前假設H擁有的初始機率,因此其通常被稱為先驗機率(prior
Time of Update: 2018-12-07
#__author__=lx#__date__=2011-10-03#__brief__=DFStime = 0d = []f = []color = []p = []def DFS_VISIT( G, i ): color[ i ] = 'gray' global time time += 1 d[i] = time print i+1 for v in G[i]: if
Time of Update: 2018-12-07
/* * author:lx * breif: 2011.09.22 * brief: quick-sort */#include <stdio.h>#include <stdlib.h>voidquick_sort( int *x, int l, int u ){ if ( l >= u ) { return; } int m = l; int i;
Time of Update: 2018-12-07
實現《機器學習》19頁的FIND-S演算法。驗證不同的執行個體順序開始於非最特殊假設。#__author__=lx#__date__=2011.10.18#__brief__=FIND-S, from 'machine learning' 19def find_s(): x1 = [ 'sunny', 'warm', 'nurmal', 'strong', 'warm', 'same' , 1 ] x2 = [ 'sunny', 'warm',
Time of Update: 2018-12-07
/** auhtor:lx date 4.9 2011 brief hash table*/#include <stdio.h>#include <stdlib.h>#include <stdbool.h>#define hash_num 5typedef char Bool;struct hash_node{int date; /*結點值*/struct hash_node *next; /*下一個節點*/ Bool found;}
Time of Update: 2018-12-07
#include <iostream>#include <fstream>#include <string>#include <vector>#include <string.h>#include <stdlib.h>#include <stdio.h>using namespace std;typedef struct ring{char a;struct ring *flink;struct ring
Time of Update: 2018-12-07
/** author lx date 3.24 2011 contact lxlenovostar@gmail.com biref cp a big file to anthor file.*/#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdlib.h>#include <unistd.h>#include <stdio.h>
Time of Update: 2018-12-07
實現: int s, con; struct sockaddr_in cliaddr, servaddr; if ( argc != 3 ) { printf( "uasage: httpd <IPaddress> <Port>"); exit( 0 ); } s = socket(AF_INET, SOCK_STREAM, 0);
Time of Update: 2018-12-07
#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "ourhdr.h"#include "error.c"#include "f10.17.c"static void lockabyte(const char *, int, off_t );int lock_reg( int fd, int cmd, int type, off_t offset, int whence,
Time of Update: 2018-12-07
文章目錄 IMPORTANT NOTEPROGRAM NAME: gift1INPUT FORMATSAMPLE INPUT (file gift1.in)OUTPUT FORMATSAMPLE OUTPUT (file gift1.out) A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of