- 浏览: 325799 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
di1984HIT:
谢谢,写的不错。
使用hector操作Cassandra -
mr_von:
非常感谢!
paoding的分词使用 -
howgoo:
http://www.dhtmlx.com/docs/prod ...
dhtmlxGrid分页与排序 -
青春的、脚步:
谢谢
spring-data-mongodb的MongoTemplate 使用小例子 -
青春的、脚步:
xiaofancn 写道青春的、脚步 写道这个能查询都个值在某 ...
spring-data-mongodb的MongoTemplate 使用小例子
http://rantav.github.com/hector/build/html/content/getting_started.html
https://github.com/zznate/hector-examples.git
private static final String DYN_KEYSPACE = "logdb"; private static final String DYN_CF = "user"; private static StringSerializer stringSerializer = StringSerializer.get(); private static LongSerializer longSerializer = LongSerializer.get(); private static Cluster cluster = HFactory.getOrCreateCluster( "Test Cluster", "localhost:9160"); public static void createSchema() { try { if (cluster.describeKeyspace(DYN_KEYSPACE) != null) { cluster.dropKeyspace(DYN_KEYSPACE); } // 字段操作 BasicColumnDefinition ageColumnDefinition = new BasicColumnDefinition(); ageColumnDefinition.setName(stringSerializer.toByteBuffer("age")); ageColumnDefinition.setIndexName("age_idx"); ageColumnDefinition.setIndexType(ColumnIndexType.KEYS); ageColumnDefinition.setValidationClass(ComparatorType.LONGTYPE .getClassName()); // 字段操作 BasicColumnDefinition usernameColumnDefinition1 = new BasicColumnDefinition(); usernameColumnDefinition1.setName(stringSerializer .toByteBuffer("username")); usernameColumnDefinition1.setIndexName("username_idx"); usernameColumnDefinition1.setIndexType(ColumnIndexType.KEYS); usernameColumnDefinition1 .setValidationClass(ComparatorType.UTF8TYPE.getClassName()); BasicColumnFamilyDefinition columnFamilyDefinition = new BasicColumnFamilyDefinition(); columnFamilyDefinition.setKeyspaceName(DYN_KEYSPACE); columnFamilyDefinition.setName(DYN_CF); columnFamilyDefinition.addColumnDefinition(ageColumnDefinition); columnFamilyDefinition .addColumnDefinition(usernameColumnDefinition1); ColumnFamilyDefinition cfUser = new ThriftCfDef( columnFamilyDefinition); KeyspaceDefinition keyspaceDefinition = HFactory .createKeyspaceDefinition(DYN_KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", 1, Arrays.asList(cfUser)); cluster.addKeyspace(keyspaceDefinition); // insert some data for (int i = 0; i < 1; i++) { List<KeyspaceDefinition> keyspaces = cluster .describeKeyspaces(); for (KeyspaceDefinition kd : keyspaces) { if (kd.getName().equals(DYN_KEYSPACE)) { System.out.println("Name: " + kd.getName()); System.out.println("RF: " + kd.getReplicationFactor()); System.out.println("strategy class: " + kd.getStrategyClass()); List<ColumnFamilyDefinition> cfDefs = kd.getCfDefs(); for (ColumnFamilyDefinition def : cfDefs) { System.out.println(" CF Type: " + def.getColumnType()); System.out.println(" CF Name: " + def.getName()); System.out.println(" CF Metadata: " + def.getColumnMetadata()); } } } } } catch (HectorException he) { he.printStackTrace(); } cluster.getConnectionManager().shutdown(); } public static void operatioinDB() { String value = ""; for (int i = 0; i < 10; i++) { value = value + "x"; } Keyspace keyspaceOperator = HFactory.createKeyspace("logdb", cluster); try { Mutator<String> userMutator = HFactory.createMutator( keyspaceOperator, stringSerializer); Long age = 1000L; long start = System.currentTimeMillis(); for (long i = 0; i < 10000 * 10000; i++) { userMutator.addInsertion("" + i, "user", HFactory.createStringColumn("username", "小贩" + i)) .addInsertion( "" + i, "user", HFactory.createColumn("age", i, stringSerializer, longSerializer)); if (i % 500 == 0) { System.out.println(i); userMutator.execute(); } } userMutator.execute(); System.out.println("消耗毫秒:" + (System.currentTimeMillis() - start)); } catch (HectorException e) { e.printStackTrace(); } cluster.getConnectionManager().shutdown(); } public static void query() { Keyspace keyspaceOperator = HFactory.createKeyspace("logdb", cluster); long value = RandomUtils.nextInt(10000 * 1); ColumnFamilyTemplate<String, String> columnFamilyTemplate = new ThriftColumnFamilyTemplate<String, String>( keyspaceOperator, "user", stringSerializer, stringSerializer); IndexedSlicesPredicate<String, String, Long> agePredicate = new IndexedSlicesPredicate<String, String, Long>( stringSerializer, stringSerializer, longSerializer); IndexedSlicesPredicate<String, String, String> usernamePredicate = new IndexedSlicesPredicate<String, String, String>( stringSerializer, stringSerializer, stringSerializer); usernamePredicate.addExpression("username", IndexOperator.EQ, "小贩" + value).startKey(""); agePredicate.addExpression("age", IndexOperator.EQ, value).startKey(""); ColumnFamilyResult<String, String> list = columnFamilyTemplate .queryColumns(usernamePredicate); System.out.println(list.getString("username")); list = columnFamilyTemplate.queryColumns(agePredicate); System.out.println(list.getLong("age")); // ====================================================================================== } public static void query2() { Keyspace keyspaceOperator = HFactory.createKeyspace("logdb", cluster); long value = RandomUtils.nextInt(10000 * 1); IndexedSlicesQuery<String, String, String> indexedSlicesQuery = HFactory .createIndexedSlicesQuery(keyspaceOperator, stringSerializer, stringSerializer, stringSerializer); indexedSlicesQuery.addEqualsExpression("username", "小贩" + value); indexedSlicesQuery.setColumnFamily("user"); indexedSlicesQuery.setStartKey(""); indexedSlicesQuery.setColumnNames("username", "age"); QueryResult<OrderedRows<String, String, String>> result = indexedSlicesQuery .execute(); System.out.println(result.get()); } public static void main(String[] args) throws Exception { query2(); }
发表评论
-
spring cloud gateway 全局过滤器。
2019-03-17 23:11 490spring cloud gateway 网关 ... -
elasticsearch 5.4搜索
2017-05-19 08:37 148@Test public void t ... -
netty简单的操作memcached
2017-04-19 18:59 939pom文件 <dependency> ... -
juc系列-Executor框架
2017-03-20 13:34 660转自 juc系列-Executor框架 什 ... -
ReentrantLock 类
2017-03-19 21:11 11.1 什么是reentrantlock java.u ... -
juc之CountDownLatch、CyclicBarrier和Semaphore例子
2017-03-19 17:23 789import java.util.concurren ... -
netty客户端与服务端例子
2017-03-12 20:07 2763package com.snailteam.nett ... -
freemaker集成spring
2017-02-26 19:00 528<bean id="freeMark ... -
spring集成Hessian插件配置改成自动注入。
2017-02-10 15:39 796原来的配置 <bean name="/ ... -
web开发模版
2017-02-09 14:42 0# Rules reminder: # DEBUG &l ... -
Java多线程
2017-02-04 14:39 486线程状态图 新建状态(New): ... -
hash冲突解决
2017-01-23 18:30 4191、开放地址法有一个公式: m是hash表长度,di ... -
mybatis +spring 分库
2015-04-30 17:56 353<context:component-scan b ... -
Java并发任务处理例子
2014-02-12 16:06 1097public void init() { su ... -
JAVA动态代理模式
2012-10-03 01:01 1145这是我要实现的效果 public static ... -
paoding的分词使用
2012-06-13 21:30 4836paoding下载 http://code.googl ... -
使用spring-hadoop操作hadoop
2012-05-20 02:12 32参考文章 http://blog.springsource. ... -
solr3.5集成paoding和位置搜索及对solrj的使用。
2012-04-28 02:12 1919http://xiaofancn.iteye.com/blog ... -
日期处理DateUtils
2012-03-24 09:47 4749import java.text.SimpleDateF ... -
Cassandra的数据分布情况测试
2012-03-16 15:09 19931、规划种子节点ip和Token值的对应 4个种子 ...
相关推荐
java NoSql Cassandra hector 做的实例,拿出来分享
rplidar使用hector_slam的hector_mapping geotiff创建地图方法
Cassandra实用教程是一份非常有价值的参考文档,它将帮助那些准备使用Cassandra作为数据进行开发的用户提高对Cassandra的认识和使用能力。
简单的介绍了hector的使用方法,有一些调用的实例,有参考价值,适合初学者使用,英文版。
关于Hector SLAM的ppt,介绍了hector slam的功能和框架。
Hector slam利用高斯牛顿方法解决scan-matching问题,对传感器要求较高。
hector slam源码hector_slam See the ROS Wiki for documentation: http://wiki.ros.org/hector_slam
java通过hector(1.1-2)连接Cassandra(1.1.7)的代码,几乎搜集了网上所有的例子,然后自己根据hector api写了一个比较全的DAO(大部分功能都有了,呵呵呵)
数据包:Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag
hector_quadrotor_tutorial修改后源码,可以在Gazebo7上运行,ubuntu 16.04+ROS kinetic上编译可通过
hector_gazebo hector_gazebo提供与使用凉亭模拟机器人相关的软件包(凉亭插件,世界文件等)。
hector_slam源码
hector_slam(noetic)-0.5.2-4 在包hector_slam仓库被释放到noetic运行发行版/usr/local/bin/bloom-release hector_slam --ros-distro noetic上Mon, 12 Apr 2021 17:51:56 -0000 这些软件包已发布: hector_...
A Flexible and Scalable SLAM System with FullStefan Kohlbrecher and Oskar von St
ROS_Hector 在进行下一步之前,先检查FSM中赫克托尔的状态,然后由主设备控制STATE并将目标设置为(粉红色点) ############################## hector_master ################## #########################发布...
实时定位与建图(SLAM),用激光传感器采集周围环境信息,建立环境地图,并计算当前机器人的位姿。
Neato-XV-11-Hector-SLAM 要使用Hector-SLAM设置Neato xv-11 LIDAR,请点击以下链接:
2、熟练LINUX系统的基本操作和Shell脚本; 3、熟练GAMIT/GLOBK软件的安装流程与使用方法; 4、熟练GLOBK平差流程和处理策略; 5、掌握应用GAMIT/GLOBK软件进行高精度GNSS工程控制网数据处理与精度评估; 6、掌握应用...
基于Hector SLAM算法的全场景自动驾驶护士床设计.pdf
$ rosdep install hector_slam_example 用法 打开你 $ roslaunch hector_slam_example hector_openni.launch UTM-30LX $ roslaunch hector_slam_example hector_hokuyo.launch UST-10LX/20LX $ roslaunch hector_...