上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要: 开始不知道怎么弄,后来看看应该是对select()函数的最后一个参数进行设置才对,改成可以命令行中输入 -w time_out的情况。不知道对不对哦。源码在这里:https://github.com/lxlenovostar/m_ping 阅读全文
posted @ 2011-12-13 19:16 lxgeek 阅读(385) 评论(0) 推荐(0) 编辑
摘要: 今天实现了控制发包频率,这个很简单,就是修改了源码中alarm()的时间,可以从命令行中读取相应的时间。代码在此:https://github.com/lxlenovostar/m_ping 阅读全文
posted @ 2011-12-12 21:23 lxgeek 阅读(788) 评论(0) 推荐(0) 编辑
摘要: #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** arg_v = argv; arg_c--, arg_v++; while (arg_c > 0 && ... 阅读全文
posted @ 2011-12-12 21:18 lxgeek 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 呵呵,接着完善 https://github.com/lxlenovostar/py_ping 阅读全文
posted @ 2011-12-09 19:43 lxgeek 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 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, C, 'CPT', [0.5 0.5] );bNet.CPD{R} = tabular_ 阅读全文
posted @ 2011-11-17 15:54 lxgeek 阅读(2909) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-11-07 20:13 lxgeek 阅读(878) 评论(0) 推荐(0) 编辑
摘要: # A dictionary of movie critics and their ratings of a small# set of moviesfrom math import sqrtcritics = { 'Lisa Rose': { 'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,'Just My Luck':3.0, 'Superman Returens':3.5, 'You, Me and Dupree': 2.5,'Th 阅读全文
posted @ 2011-11-07 18:27 lxgeek 阅读(683) 评论(0) 推荐(0) 编辑
摘要: #__author__=lx#__date__=2011-11-02def triangle( a, b, c ): if a + b > c and a + c > b and b + c > a : if a != b and a != c and b !=c : print "Ordinary triangle" else : if a == b and a == c: ... 阅读全文
posted @ 2011-11-02 14:21 lxgeek 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 解决这一问题的有效的方法是使用嵌套乘法也叫做Horner方法,这样计算该多项式仅用了4次乘法和4次加分。通常一个d次多项式能够d次乘法和d次加法进行计算。matlab程序如下:%Program 0.1 Nested multiplication%Evaluates polynomial from nested form using Horner's method%Input: degree d of polynomial,% array of d+1 coefficients (constant term first),% x-coordinate x at which... 阅读全文
posted @ 2011-10-29 15:38 lxgeek 阅读(312) 评论(0) 推荐(0) 编辑
摘要: getattr函数,可以得到一个直到运行时才知道名称的函数的应用。>>> li = [ "Larry", "Curly" ]>>> li.pop<built-in method pop of list object at 0xb76b364c>>>> getattr( li, "pop" )<built-in method pop of list object at 0xb76b364c>>>> getattr( li, "app 阅读全文
posted @ 2011-10-29 12:42 lxgeek 阅读(1454) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页