随笔分类 -  每日一技

记录编程中遇到的问题并解决
摘要:SoftirqsTasklets Tasklets have a simpler interface and relaxed locking rules than softirqs. Tasklets are represented by two softirqs:HI_SOFTIRQ and TASKLET_SOFTIRQ. 阅读全文
posted @ 2012-05-09 16:32 lxgeek 阅读(241) 评论(0) 推荐(0) 编辑
摘要:the keyboard controller(the hardware device) =======================> processor=============>operating system an electrical signal signalDifferent devices can be associated with different interrupts by means of a unique value associated with each... 阅读全文
posted @ 2012-05-01 14:02 lxgeek 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-04-28 20:15 lxgeek 阅读(124) 评论(0) 推荐(0) 编辑
摘要:-rw-r--r-- Access rights to the file.The first character indicated the type of file. a leading dash means a regular file, while a 'd' indicates a directory. the next three characters are the access rights for the file's owner, the next three are for members ... 阅读全文
posted @ 2012-04-25 21:50 lxgeek 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Unix-like systems such as linux always have a single file system tree, regardless ofhow many drives or storage devices are attached to the computer.Storage devicesare attached( mounted ) at various points on the tree according to the system administrator.absolute pathnamesan absolute pathname begins 阅读全文
posted @ 2012-04-17 23:22 lxgeek 阅读(122) 评论(0) 推荐(0) 编辑
摘要:shell is a program that takes keyword commdands and passes them tothe operating system to carry out.when you use GUI,KDE uses konsole and GNOME usesgnome-terminal. $ is called a shell prompt and it will appear whenever the shell is ready to accept input.# means you logged in as the root us... 阅读全文
posted @ 2012-04-16 22:51 lxgeek 阅读(155) 评论(0) 推荐(0) 编辑
摘要:typedef struct { int counter;} atomic_t;#ifdef CONFIG_64BITtypedef struct { long counter;} atomic64_t;#endiflinux 内核使用特殊的数据类型atomic_t来代替直接使用C语言的整型,是出自以下几个原因:(1)关于atomic_t的函数只接受atomic_t类型(2)使用atomic_t类型可以避免编译器的优化,原子操作对于使用正确的内存地址很重视。(3)可以避免CPU的体系结构的问题这里就有个问题,为什么使用结构体就可以避免原因(2),编译器没有优化之,g... 阅读全文
posted @ 2012-03-30 22:31 lxgeek 阅读(339) 评论(0) 推荐(0) 编辑
摘要:用法: python test.py /home/lx/c/test#test how much lines in a directory.import os,sysdef cout( current_doc ): os.chdir( current_doc ) doc_list = os.listdir( current_doc ) for i in doc_list: if os.path.isfile( i ): os.system( 'wc -l ' +... 阅读全文
posted @ 2012-03-30 16:09 lxgeek 阅读(182) 评论(0) 推荐(0) 编辑
摘要:#include <locale.h>#include <stdlib.h>#include <stdio.h>intmain( void ){ printf( "%s\n", setlocale( LC_ALL, "" ) ); exit(0);} 阅读全文
posted @ 2012-03-11 20:41 lxgeek 阅读(201) 评论(0) 推荐(0) 编辑
摘要:in_cksum(addr, len)u_short *addr;int len;{ register int nleft = len; register u_short *w = addr; register u_short answer; register int sum = 0; /* * Our algorithm is simple, using a 32 bit accumulator (sum), * we add sequential 16 bit words to it,... 阅读全文
posted @ 2012-01-05 15:23 lxgeek 阅读(635) 评论(0) 推荐(0) 编辑
摘要:#author=lx#date=2011-12-27import osimport sysclass node: "store the information of a node in bnt" def __init__( self, nodename=None, cptnum=2, pnum=0, cnum=0, parename=None, childname=None ): self.node_name = nodename self.cpt_num = cptnum s... 阅读全文
posted @ 2011-12-27 19:47 lxgeek 阅读(619) 评论(0) 推荐(0) 编辑
摘要:#! /bin/bashLX=100for i in 1 2 3do c=$(echo "scale=2;$i/$LX"|bc) echo -n "0$c ";doneecho; 阅读全文
posted @ 2011-12-22 17:31 lxgeek 阅读(513) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h>#include <stdlib.h>typedef unsigned char *byte_pointer;void show_bytes( byte_pointer start, int len ){ int i; for ( i = 0; i < len; i++ ) { printf( "%.2x", start[i] ); } printf( "\n" );}void show_int( int x ){ show_bytes( (by... 阅读全文
posted @ 2011-12-21 17:01 lxgeek 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-12-15 19:18 lxgeek 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-12-15 16:44 lxgeek 阅读(1271) 评论(0) 推荐(0) 编辑
摘要:开始不知道怎么弄,后来看看应该是对select()函数的最后一个参数进行设置才对,改成可以命令行中输入 -w time_out的情况。不知道对不对哦。源码在这里:https://github.com/lxlenovostar/m_ping 阅读全文
posted @ 2011-12-13 19:16 lxgeek 阅读(389) 评论(0) 推荐(0) 编辑
摘要:今天实现了控制发包频率,这个很简单,就是修改了源码中alarm()的时间,可以从命令行中读取相应的时间。代码在此:https://github.com/lxlenovostar/m_ping 阅读全文
posted @ 2011-12-12 21:23 lxgeek 阅读(790) 评论(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 阅读(248) 评论(0) 推荐(0) 编辑
摘要:呵呵,接着完善 https://github.com/lxlenovostar/py_ping 阅读全文
posted @ 2011-12-09 19:43 lxgeek 阅读(153) 评论(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 阅读(2922) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示