现在位置: 首页 > KindraAlger发表的所有文章
  • 10月
  • 17日
综合 ⁄ 共 956字 评论关闭
#include <iostream> using namespace std; #define MAX 4 /** * (组合: C(m,n)) * 从n个元素中选择m个元素,他们之间没有次序关系 * 以1,2,3,4为例,n=4,m=2。C[]存放组合结果。 * 先确定c[0]=1,然后再从剩下的3(n-i-1)个中选择1(m-1)个。 * 第二轮确定c[0]=2,然后再从剩下的2(n-i-1)个中选择1(m-1)个。 * 直到确定c[0]=3,再往下剩下的元素里面没有m-1个了,不能再选。 * * 要点:每次都只能选择起始点后面的数字(避免重复),所以设置curPos变量 * a[]: 候选集, n: 大小,m: 选择m个, result[]: 存放组合结果......
阅读全文
  • 02月
  • 17日
综合 ⁄ 共 2869字 评论关闭
Walk Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 651    Accepted Submission(s): 402Special Judge Problem Description I used to think I could be anything, but now I know that I couldn't do anything. So I started traveling. The nation looks like a connected bidirectional graph, and I am randomly walking on it. It means when I am at node i, I will travel to an adjacent node with the same probability in the next step. I will pick ......
阅读全文
  • 09月
  • 15日
综合 ⁄ 共 433字 评论关闭
List<Map<String>> Items = new ArrayList<Map<String>>(); // 把该显示的内容放到list中 for (int i = 0; i < HELP_NAME.length; i++) { Map<String, Object> item = new HashMap<String, Object>(); item.put("textview1", HELP_NAME[i]); Items.add(item); } // 构建适配器Adapter,将数据与显示数据的布局页面绑定 SimpleAdapter simpleAdapter = new SimpleAdapter(this, Items, R.layout.listitem, new String[] { "textview1", "image" }, new int[] { R.id.text_item_id}); // 通过......
阅读全文
  • 06月
  • 06日
综合 ⁄ 共 1206字 评论关闭
每一个TCP套接口有一个发送缓冲区,可以用SO_SNDBUF套接口选项来改变这个缓冲区的大小。当应用进程调用write时,内核从应用进程的缓冲区中拷贝所有数据到套接口的发送缓冲区。如果套接口的发送缓冲区容不下应用程序的所有数据(或是应用进程的缓冲区大于套接口发送缓冲区,或是套接口发送缓冲区还有其他数据),应用进程将被挂起(睡眠)。这里假设套接口是阻塞的,这是通常的缺省设置。内核将不从write系统调用返回,直到应用进程缓冲区中的所有数据都拷贝到套接口发送缓冲区。因此从写一个TCP套接口的write调用成功返回仅仅表示我们......
阅读全文
  • 04月
  • 20日
综合 ⁄ 共 731字 评论关闭
最近学了ruby,快乐编程果真名不虚传。尝试写了个生成随机数的脚本,算是练手。 一、功能需求 输入随机数区间[a,b), 和数据规模c,输出c个位于区间内的随机整数,每个输出一行。 二、编写代码 #! /usr/bin/ruby # Example: # genrand 3 8 4 # will generate 4 Integer range from 3 to 8 #This application is used for generate random numbers # 1) in range of a b # 2) repeat c times to generate c numbers. def genrand(a,b,c) a=a.to_i b=b.to_i c=c.to_i if a>b a,b=b,a end c.times do p......
阅读全文
  • 04月
  • 13日
综合 ⁄ 共 2769字 评论关闭
一.类型转换       在上一个博文解析了XML文件之后,由于解析之后得到的数据都是Unicode类型的,在一些场合并不适用,因此,需要将获得的数据进行类型转换,主要是将Unicode转换为int, string和float类型,主要代码如下: ''' Created on 2014-6-20 @author: sheng ''' def ConvertUnicodeToInt(InputUnicode): """Convert the Unicode to integer""" result = int(InputUnicode) return result def ConvertUnicodeToString(InputUnicode): """Convert the Unicode to string""" result = ......
阅读全文
  • 04月
  • 01日
综合 ⁄ 共 4021字 评论关闭
Unix编程艺术中的17点编程哲学原则           ---设计开发者的至高准则   译者:July   二零一一年一月十三日。 参考文献:The Art of Unix Programming  By Eric Steven Raymond 博主说明:本文是依据unix编程艺术一书的英文版,第一章部分章节,所做的翻译。 翻译过程中,参考了其中文版(姜宏等译)。若有更好的翻译意见,欢迎留言提议。 --------------------------------------- 一、unix编程艺术一书介绍本书主要介绍了Unix系统领域中的设计和开发哲学、思想文化体系、原则与经验, 由公认的Unix编程大师、开源运动领......
阅读全文
  • 02月
  • 04日
综合 ⁄ 共 198字 评论关闭
基础 词汇 + 语法 进阶  句型 1. 阅读题     1.1  做完     1.2  对答案     1.3 分析原因     1.4  不认识的单词、好的句子(句型)、语法结构不理解的。     1.5  整理            不认识的单词     查出来            好的句子(句型)统计出来            语法结构不理解的   查语法书,查出来。 2. 其它的题均可以按照此方式开展 3. 作文 3.1 先看范文 3.2 分析文章的结构,记述文、议论文(较多) 3.3 模仿写
阅读全文
  • 12月
  • 19日
综合 ⁄ 共 658字 评论关闭
共享存储区的创建 ,附接,和断接。 #include<sys/types.h>#include<sys/msg.h>#include<sys/ipc.h> #define SHMKEY 75 int shmid , i ;int  * addr; void CLIENT(){   int i;   shmid = shmget(SHMKEY, 1024,0777|IPC_CREAT);   addr = shmat(shmid,0,0);   for(i = 9 ; i>= 0 ; i --)   {      while(* addr != -1);      printf("(client)sent/n");      * addr = i;   }   exit(0);} void SERVER(){   shmid = shmget(SHMKEY,1024,0777|IPC_CREAT);   addr = shmat(shmid,0,0);   do    {       * addr =......
阅读全文
  • 09月
  • 18日
综合 ⁄ 共 12142字 评论关闭
      在Qte下使用QFileDialog时,编译会出现如上问题。也就是说Qte不支持类QFileDialog。我在网上搜了一下解决方法,有网友提供自己编写的QFileDialog类: filedialog.h文件 /************************************************************ Copyright (C), 2009, SEU Author: hxfirefox FileName: filedialog.h Date: 12/09/2009 Description: 替代Qt中的QFileDialog ***********************************************************/ #ifndef FILEDLG_H #define FILEDLG_H #include <qdir.h> #include <qdia......
阅读全文
  • 06月
  • 08日
综合 ⁄ 共 1316字 评论关闭
What is GoLISMERO? GoLISMERO is a web spider is able to detect vulnerabilities and format results a very useful when starting a web audit. It's for? GoLISMERO is intended to be a first step when starting a web security audit. Every time we face a new URL, would not it be great to have easily and quick all the links, forms with parameters, to detect possible URL vulnerable and in addition to being presented so that gives us an idea of ​​all points of entry where we could launch attacks......
阅读全文
  • 10月
  • 27日
综合 ⁄ 共 3389字 评论关闭
webservice 的出现带来了一场革命,它使各个系统、平台、程序直接不在有鸿沟,对综合的企业应用是大的解放。我一直深爱她,美丽的桥梁(Beautiful Rainbow)。 下面说一下SOA SOA的全称是Service Oriented Architecture,即面向服务的架构。在定义SOA之前我们先看看服务(service)的定义。在现实生活中,服务指的是我们支付后而获得的服务内容。例如:去酒店吃饭时点菜的服务内容,首先客人走到柜台点菜,然后厨房将为客人准备食物,最后服务生上菜给客人。在这个过程中,柜台点菜、厨房做菜以及服务生上菜这三个部分分别就是服务......
阅读全文