现在位置: 首页 > chengsongfa发表的所有文章
  • 03月
  • 20日
综合 ⁄ 共 3983字 评论关闭
原文地址:http://www.blogbus.com/public/tb.php/1376295/4862205/d489c231edb979476798ac5d29c8d449   一般来说,多进程环境下的Linux程序,子进程是继承父进程的信号处理方式的。也就是说,如果在父进程中为某一个信号指定了处理函数,那么子进程在收到这个信号时同样会调用这个处理函数。 举例如下: #include <signal.h> #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <wait.h> #include <sys/time.h> #include <sys/resource.h> #include <time.h......
阅读全文
  • 03月
  • 13日
综合 ⁄ 共 1845字 评论关闭
一、 Arena插件配置 1. 下载Arena      指针:http://community.topcoder.com/tc?module=MyHome      左边Competitions->Algorithms->Single Match Rounds->Launch Arena->Load Competition Arena 2. 下载插件      指针:http://community.topcoder.com/tc?module=Static&d1=applet&d2=plugins      下载三个插件:FileEdit,CodeProcessor1.2,TZTester       将1中下载的Arena和2中下载的三个插件放在同一个目录下。 3. 插件配置  启动Arena并登陆          要运行Arena,需要有JRE(Java Runtime Envir......
阅读全文
  • 12月
  • 15日
综合 ⁄ 共 1564字 评论关闭
HDU 1556 Color the ball解题报告 一、原题 Color the ball Description N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?   Input 每个测试实例第一行为一个整数N,(N <= 100000).接下来的N行,每行包括2个整数a b(1 <= a <= b <= N)。 当N = 0,输入结束。   Output 每个测试实例输出一行,包括N个整数,......
阅读全文
  • 06月
  • 09日
综合 ⁄ 共 1077字 评论关闭
原文:合并两个文件 源代码下载地址:http://www.zuidaima.com/share/1550463699438592.htm 使用java合并两个已存在的文件的内容到一个新的文件去 import java.io.*; package com.zuidaima.file.util; /** *@author www.zuidaima.com **/ class combinefile{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //get the path of file System.out.print("please enter the path of first file"); String filebr1=br.readLine()......
阅读全文
  • 05月
  • 19日
综合 ⁄ 共 6137字 评论关闭
前篇关于Spring Batch的文章,讲述了Spring Batch 对XML文件的读写操作。 本文将通过一个完整的实例,与大家一起讨论运用Spring Batch对固定长格式文件的读写操作。实例延续前面的例子,读取一个含有四个字段的TXT文件(ID,Name,Age,Score),对读取的字段做简单的处理,然后输出到另外一个TXT文件中。       工程结构如下图:       applicationContext.xml和log4j.xml前文已经叙述过,在此不做赘述。       本文核心配置文件batch.xml内容如下: 1 <?xml version="1.0" encoding="UTF-8"?> 2 <bean:beans xmlns="h......
阅读全文
  • 05月
  • 08日
综合 ⁄ 共 3666字 评论关闭
了解Spring包结构有助于我们减小发布包的大小,同时也可以增加对Spring架构的了解。 spring.jar是包含有完整发布模块的单个jar 包。但是不包括mock.jar, aspects.jar, spring-portlet.jar, and spring-hibernate2.jar。 spring-src.zip就是所有的源代码压缩包。 除了spring.jar 文件,Spring 还包括有其它21 个独立的jar 包,各自包含着对应的Spring组件,用户可以根据自己的需要来选择组合自己的jar 包,而不必引入整个spring.jar 的所有类文件。 spring-core.jar 这个jar 文件包含Spring 框架基本的核心工具类。Spring 其它组......
阅读全文
  • 03月
  • 31日
综合 ⁄ 共 1504字 评论关闭
看了一下网上面的例子都是Jeremiah写的0.9.9a的一个MFC对话框的例子,详见http://jeremiah.blog.51cto.com/539865/d-1。现在1.1.7很多函数的接口都不一样了。   官网上给的是linux的例子,http://wiki.videolan.org/LibVLC_Tutorial。很多同学不懂得随机应变,给了linux的例子就不懂得怎么在VS2008下面编译。   1. 安装VLC播放器,在播放器的路径下面拷贝libvlc.dll和libvlccore.dll到C:/Program Files/Microsoft Visual Studio 9.0/VC/bin目录下,然后运行vcvar32.bat,配置环境变量,接下来运行dumpbin /exports libvlc.dll >......
阅读全文
  • 02月
  • 16日
综合 ⁄ 共 4793字 评论关闭
Windows phone 应用开发[1]-Text To Speech        作为开篇章节.第一篇将在如下介绍一些Windows phone比较有意思的东西-Text To Speech[文本到语音转换]. 相信大家最近一定对IPhone 4S 的Siri影响深刻.其实作为智能Smart Phone一个终极标准之一就是实现人类语言和机器语言的无障碍. 也就是第三次GUI革命-人机智能领域.这个我会稍后几篇提到Siri实现原理和Windows phone 在语音Tellme实现和发展情况. http://www.apkbus.com/android-138325-1-1.htmlWindows phone 应用开发[2]-数据缓存        今天把JDi/Server测......
阅读全文
  • 02月
  • 12日
综合 ⁄ 共 8730字 评论关闭
    2. Terminology 2. 术语   In this section we first summarize some middlebox terms. We focus hereon the two kinds of middleboxes that commonly cause problems for P2P applications. 在这一章节中,首先概要的介绍一下“代理”技术的一些术语。然后集中讨论两种造成P2P应用问题的代理机制。   Firewall A firewall restricts communication between a private internal network and the public Internet, typically by dropping packets that are deemed unauthorized. A firewall examines but does not modify the IP ......
阅读全文
  • 01月
  • 12日
综合 ⁄ 共 1472字 评论关闭
P03: 多重背包问题 题目:        有N种物品和一个容量为V的背包。第i种物品最多有n[i]件可用,每件费用是c[i],价值是w[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。 基本算法       这题目和完全背包问题很类似。基本的方程只需将完全背包问题的方程略微一改即可,因为对于第i种物品有n[i]+1种策略:取0件,取1件……取n[i]件。令f[i][v]表示前i种物品恰放入一个容量为v的背包的最大权值,则有状态转移方程:           f[i][v]=max{f[i-1][v-k*c[i]]+k*w[i]|0<=k<=n[i]} 复杂度是O(V*......
阅读全文
  • 12月
  • 09日
综合 ⁄ 共 5343字 评论关闭
默认地,所有index的下标均从0开始。 一 list1) list 基础 >>> a = ['money', 'money', 'money', 100000000]>>> a['money', 'money', 'money', 100000000]>>> a[3]100000000>>> a[-1] = a[-1] * 2>>> a[-1]200000000>>> ['i', 'want'] + a['i', 'want', 'money', 'money', 'money', 200000000]>>> a['money', 'money', 'money', 200000000]>>> a[:0] = ['i', 'want']>>> a['i', 'want', 'money', 'money', 'money', 200000000]>>> a[2......
阅读全文
  • 12月
  • 08日
综合 ⁄ 共 4348字 评论关闭
行为模式涉及到算法和对象间职责的分配。interpreter:给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器用来解释语言中的句子。 package behaviour.interpreter; import behaviour.interpreter.mypackage.BooleanExp; /** *  A NonterminalExpression */public class AndExp implements BooleanExp {    private BooleanExp operand1;    private BooleanExp operand2;        public AndExp(BooleanExp oper1, BooleanExp oper2) {        operand1 = oper1;        operand2 = oper2;    }     public boolea......
阅读全文