现在位置: 首页 > drewattiday发表的所有文章
  • 08月
  • 16日
综合 ⁄ 共 1691字 评论关闭
题目链接:uva 1399 - Puzzle 题目大意:给定K和N,表示有K种不同的字符,N个禁止串,求一个最长的串使得该串不包含任何禁止串为子串。如果存在循环或者不能构成的话,输出No。 解题思路:建立AC自动机,然后在AC自动机上做dp,所有单词结尾节点为禁止点。 #include <cstdio> #include <cstring> #include <queue> #include <algorithm> using namespace std; const int maxn = 50005; const int sigma_size = 26; struct Aho_Corasick { int sz, ac[maxn][sigma_size]; int fail[maxn], las......
阅读全文
1. 按照《net-snmp(5.7.2)移植到arm》的方法编译得到适用于arm的snmptrap,用arm-linux-strip snmpd命令压缩; 2. 按照《linux nfs挂载方法》的方法登录arm系统并挂载主机上的nfs文件,将snmptrap拷贝到nfs里;将snmptrap拷贝到arm文件系统里; 3. 按照《snmp v3 trap(send and receive use net-snmp》的方法配置主机的snmptrapd,开启snmptrapd等待接受trap; 4. arm发送v3 trap: ./snmptrap -v 3 -n "" -a SHA -A mypassword -x AES -X mypassword -l authPriv -u traptest -e 0x8000000001020304 10.53.11.12 0 1.3.6.1.4.1.33......
阅读全文
  • 02月
  • 09日
综合 ⁄ 共 2100字 评论关闭
hdu1698: #include<cstdio> #define maxn 111111 #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 int sum[maxn<<2]; int col[maxn<<2]; void PushDown(int rt,int m) { if(col[rt]) { sum[rt<<1]=(m-(m>>1))*col[rt];//这里左儿子的区间长为m-(m>>1),左儿子是从l-(l+r)>>1,取较长的一段 sum[rt<<1|1]=(m>>1)*col[rt];//右儿子的区间长为m>>1 col[rt<<1]=col[rt<<1|1]=col[rt]; col[rt]=0; ......
阅读全文
  • 08月
  • 05日
综合 ⁄ 共 4049字 评论关闭
Download source (Application Form, and HexEncoding Class) - 5 Kb This original article is from http://www.codeproject.com/KB/recipes/hexencoding.aspx Introduction While the .NET framework provides methods to convert a byte array into a Hexadecimal string ( byte.ToString(�X�) ), it is not so easy to convert a hexadecimal string back into a byte array. Such a function is useful when you need to backup data from your application on paper, such as an encryption key, and later, convert it b......
阅读全文
  • 06月
  • 05日
综合 ⁄ 共 1426字 评论关闭
Hive默认是静态分区,我们在插入数据的时候要手动设置分区,如果源数据量很大的时候,那么针对一个分区就要写一个insert,比如说,我们有很多日志数据,我们要按日期作为分区字段,在插入数据的时候我们不可能手动的去添加分区,那样太麻烦了。还好,Hive提供了动态分区,动态分区简化了我们插入数据时的繁琐操作。 使用动态分区的时候必须开启动态分区(动态分区默认是关闭的),语句如下: set hive.exec.hynamic.partition=true; 下面我们再介绍几个参数: set hive.exec.dynamic.partition.mode=nonstrict 注:这个属性默认是s......
阅读全文
  • 05月
  • 17日
综合 ⁄ 共 10972字 评论关闭
ByteArrayOutputStream此类实现了一个输出流, 其中的数据被写入一个 byte 数组。 缓冲区会随着数据的不断写入而自动增长。可使用 toByteArray() 和 toString() 获取数据。 它最大的作用就是缓冲。其实是把数据先写到内存里面了。其实是把流转换成byte数组 并且写到内存中。 /** * 把一个inputstream里面的内容转化成一个byte[] * @throws IOException */ public static byte[] getBytes(InputStream inputStream) throws IOException{ ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buffer = new ......
阅读全文
  • 05月
  • 09日
综合 ⁄ 共 4459字 评论关闭
转自:http://blog.csdn.net/jojo52013145/article/details/5783677?reload 1. 我们不禁要问,什么是"服务集群"?什么是"企业级开发"?  既然说了EJB 是为了"服务集群"和"企业级开发",那么,总得说说什么是所谓的"服务 集群"和"企业级开发"吧! 这个问题其实挺关键的,因为J2EE 中并没有说明白,也没有具体的指标或者事例告诉 广大程序员什么时候用EJB 什么时候不用。于是大家都产生一些联想,认为EJB"分布式运 算"指得是"负载均衡"提高系统的运行效率。然而,估计很多人都搞错了,这个"服务群集" 和"分布式运算"并没有根本解......
阅读全文
  • 05月
  • 06日
综合 ⁄ 共 5316字 评论关闭
界面很简单,功能也实现的很简单, 一个简单的DEMO, 欢迎转载,请加地址http://blog.csdn.net/jing110fei/article/details/39055809 1主页面 2点击开启发送后        设置每隔10秒发送1次直到用户点击通知栏或点击停止发送 点击通知栏,会跳转 首先的一点是,为了能使所有Actvity都能方便的调用同一对象或者方法,我自定义了Application public class AllApplication extends Application{ public ScheduledExecutorService scheduledThreadPool; @Override public void onCreate() { // TODO Auto-generated method......
阅读全文
  • 01月
  • 16日
综合 ⁄ 共 2022字 评论关闭
OGRE渲染物体,可以把物体作为InstancedGeometry,StaticGeometry,Entity实例来渲染。 区别: InstancedGeometry:Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene。也就是说,把所有网格作为一个instance geometry。 this shader instancing implementation stores only 80 times the object, and then re-uses the vertex data with different shader parameter.只可以存储同一物体80次,然后重用顶点数据使用不同的渲染参数。 可以每帧调整位置,方向,大小等 StaticGeometry:把所......
阅读全文
 1、复合通过包含作为实例变量的的对象指针实现的。        @interface Unicycle : NSObject        {           Pedal*pedal;           Tire*tire;         }//Pedal和tire通过复合的方式组成了Unicycle 2、存取方法——用来读取或者改变某个对象属性的方法。 #import <Foundation/Foundation.h> @interface Car : NSObject {     Engine *engine;     Tire * tires[4]; } - (Engine *) engine;//getter访问器 - (void) setEngine : (Engine *)newEngine;//setter访问器 - (Tire *) tireAtIndex : (int)index; - (void)......
阅读全文
  • 12月
  • 14日
综合 ⁄ 共 235字 评论关闭
矩阵A式n阶可逆矩阵的等价条件: 1. A的行列式不等于0 2. A的秩等于n,即A为满秩矩阵 3. A的行(列)向量组线性无关 4. 齐次方程组Ax=0只有零解 5. 对于任意b属于Rn(n为上标,表示向量空间),Ax=b总有唯一解 6. A与单位矩阵等价 7. A可表示成若干个初等矩阵的乘积 8. A的列向量可以作为n维向量空间Rn(n为上标)的一组基 9. Rn中任意一个向量都可以由A的列向量线性表出 10. A的特征值全不为0 11. AT·A是正定矩阵(其中T为上标,表示A的转置) 12. A是非奇异的
阅读全文
  • 12月
  • 05日
综合 ⁄ 共 625字 评论关闭
Android用Intent来做activity的跳转,轻量级的数据用Bundle配合着传递。 传回数据用startActivityForResult来搞。 跳转时代码: _Intent=newIntent(); _Intent.setClass(getBaseContext(), Appearance.class); startActivityForResult(_Intent,1); 重载方法: @Override protectedvoid onActivityResult(intrequestCode, intresultCode, Intent data) { Bundle _Bundle; switch(requestCode) { case1: if(resultCode == RESULT_OK) { _Bundle = data.getExtras(); ......
阅读全文