offset

串的实现

巧了我就是萌 提交于 2019-12-03 18:44:25
主类 public class Question1 { public static void main(String[] args) { //串比较 MyString str1=new MyString("怀化学院".toCharArray()); MyString str2=new MyString("怀化师专".toCharArray()); int n=str1.compareTo(str2); if(n<0){ System.out.println("怀化学院大"); }else if(n>0){ System.out.println("怀化师专大"); }else{ System.out.println("一样大"); } } } public class Question2 { public static void main(String[] args) { // 串定位 MyString str1=new MyString("怀化学院计算机科学与工程学院".toCharArray()); MyString str2=new MyString("学院".toCharArray()); int n=str1.indexOf(str2,0); if(n==-1){ System.out.println("-----不包含检索内容------"); }else{ System

echarts---问题记录

三世轮回 提交于 2019-12-03 17:14:35
颜色纵向渐变 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(19,225,225,0.4)' }, { offset: 1, color: 'rgba(19,225,225,0)' }]) 颜色横向渐变 color: { colorStops: [{ offset: 0, color: '#0085ff' // 0% 处的颜色 }, { offset: 1, color: '#00e3f4' // 100% 处的颜色 }], globalCoord: false, // 缺省为 false } 来源: https://www.cnblogs.com/zhengziru/p/10369412.html

kafka的offset相关知识

為{幸葍}努か 提交于 2019-12-03 17:11:38
Offset存储模型 由于一个partition只能固定的交给一个消费者组中的一个消费者消费,因此Kafka保存offset时并不直接为每个消费者保存,而是以 groupid-topic-partition -> offset 的方式保存。 如图所示: Kafka在保存Offset的时候,实际上是将Consumer Group和partition对应的offset以消息的方式保存在__consumers_offsets这个topic中 。 __consumers_offsets默认拥有50个partition,可以通过 Math.abs(groupId.hashCode() % offsets.topic.num.partitions) 的方式来查询某个Consumer Group的offset信息保存在__consumers_offsets的哪个partition中。 下图展示了__consumers_offsets中保存的offset消息的格式: 如图所示,一条offset消息的格式为groupid-topic-partition -> offset。 因此consumer poll消息时,已知groupid和topic,又通过Coordinator分配partition的方式获得了对应的partition,自然能够通过Coordinator查找__consumers

Customizing Persistent Bottom Sheet STATE_EXPANDED height or offset

泄露秘密 提交于 2019-12-03 14:47:01
问题 Like the titles said, is there anyway to customize the size/height/offset of the official bottomSheet (Support library 23.x.x) when it is in STATE_EXPANDED state? There is a class BottomSheetBehavior but I can't find anything about height or offset. What I want is get a similar behavior like Google Maps: 回答1: After digging on Android code and searching I got it: You can do it modifying default BottomSheetBehavior adding one more stat with following steps: Create a Java class and extend it

elasticsearch 和Ik 以及 logstash 同步数据库数据

六眼飞鱼酱① 提交于 2019-12-03 14:40:22
前文章有提到如何安装es ik是默认的中文分词是将每个字看成一个词,这显然是不符合要求的,所以我们需要安装中 文分词器来解决这个问题。 IK分词是一款国人开发的相对简单的中文分词器。虽然开发者自2012年之后就不在维护 了,但在工程应用中IK算是比较流行的一款!我们今天就介绍一下IK中文分词器的使用。 下面介绍安装ik插件和使用 下载ik压缩包地址 https://files.cnblogs.com/files/blackCatFish/elasticsearch-analysis-ik-5.6.8(1).zip (1)先将其解压,将解压后的elasticsearch文件夹重命名文件夹为ik (2)将ik文件夹拷贝到elasticsearch/plugins 目录下。 (3)重新启动,即可加载IK分词器 IK提供了两个分词算法ik_smart 和 ik_max_word 其中 ik_smart 为最少切分,ik_max_word为最细粒度划分 我们分别来试一下 (1)最小切分:在浏览器地址栏输入地址http://99.47.133.165:9200/_analyze?analyzer=ik_smart&pretty=true&text=我是程序员 结果如下: { "tokens" : [ { "token" : "我", "start_offset" : 0, "end

Kafka Streams开发入门(4)

爷,独闯天下 提交于 2019-12-03 13:17:38
背景 上一篇 演示了filter操作算子的用法。今天展示一下如何根据不同的条件谓词(Predicate)将一个消息流实时地进行分流,划分成多个新的消息流,即所谓的流split。有的时候我们想要对消息流中的不同消息类型进行不同的处理逻辑,此时流split功能就显得非常的实用。 演示功能说明 今天依然使用表征一个电影的消息类型,格式如下: { "name": "Meryl Streep", "title": "The Iron Lady", "genre": "drama"} { "name": "Will Smith", "title": "Men in Black", "genre": "comedy"} { "name": "Matt Damon", "title": "The Martian", "genre": "drama"} { "name": "Judy Garland", "title": "The Wizard of Oz", "genre": "fantasy"} name是主演,title是影片名,genre是影片类型。我们今天使用Kafka Streams来演示将不同genre类型的影片split到不同的消息流中。 值得一提的是,我们今天依然使用protocol buffer对消息进行序列化和反序列化。 初始化项目 第一步是对项目进行初始化

Java源码阅读计划(1) String<II>

自作多情 提交于 2019-12-03 11:59:15
String的构造函数 String 有很多构造函数,不同种类的有不同的作用,接下来我们一个个看下去 1 public String() { this.value = "".value; } 初始化一个 String 对象,使其表示一个空字符串序列,由于字符串的不可变性,这个方法其实是不必要的。 2 public String(String original) { this.value = original.value; this.hash = original.hash; } 简单易懂,除非需要显式复制,否则这个方法也是不必要,因为字符串的不可变性。 3 public String(char value[]) { this.value = Arrays.copyOf(value, value.length); } 依然很简单,不过要注意字符数组的后续修改不会影响新创建的字符串。 4 public String(char value[], int offset, int count) { if (offset < 0) { throw new StringIndexOutOfBoundsException(offset); } if (count <= 0) { if (count < 0) { throw new StringIndexOutOfBoundsException

In Kafka how to get the exact offset according producing time

浪子不回头ぞ 提交于 2019-12-03 11:58:02
问题 I need to get the message produced in Kafka hour by hour in a day. Every one hour I will launch a job to consume the message produced 1 hour ago. e.g., if current time is 20:12, I will consume the message between 19:00:00 and 19:59:59. That means I need to get start offset by time 19:00:00 and end offset by time 19:59:59. I used SimpleConsumer.getOffsetsBefore as shown in 「0.8.0 SimpleConsumer Example」. The problem is the returning offset does not match the timestamp given as a parameter. e.g

Kafka consumer offset max value?

冷暖自知 提交于 2019-12-03 11:55:08
问题 I was googling and reading Kafka documentation but I couldn't find out the max value of a consumer offset and whether there is offset wraparound after max value. I understand offset is an Int64 value so max value is 0xFFFFFFFFFFFFFFFF. If there is wraparound, how does Kafka handle this situation? 回答1: According to this post, the offset is not reset: We don't roll back offset at this moment. Since the offset is a long, it can last for a really long time. If you write 1TB a day, you can keep

关于怎么获取kafka指定位置offset消息(转)

我是研究僧i 提交于 2019-12-03 11:47:54
1.在kafka中如果不设置消费的信息的话,一个消息只能被一个group.id消费一次,而新加如的group.id则会被“消费管理”记录,并指定从当前记录的消息位置开始向后消费。如果有段时间消费者关闭了,并有发送者发送消息那么下次这个消费者启动时也会接收到,但是我们如果想要从这个topic的第一条消息消费呢? public class SimpleConsumerPerSonIndex2 { public static void main(String[] args) throws Exception { //Kafka consumer configuration settings String topicName = "mypartition001"; Properties props = new Properties(); props.put("bootstrap.servers", "localhost:9092"); props.put("group.id", "partitiontest112"); props.put("enable.auto.commit", "true"); props.put("auto.commit.interval.ms", "1000"); props.put("session.timeout.ms", "30000"); /