上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: 机器:192.168.180.101192.168.187.16需要准备的软件有:zookeeper(zookeeper-3.4.4.tar.gz),storm(storm-0.8.1.zip) ,jdk1、配置zookeeper解压zookeeper,将conf目录下的zoo_sample.cfg 重命名为:zoo.cfg修改后内容为:# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitL 阅读全文
posted @ 2013-03-04 18:17 涛光 阅读(7696) 评论(0) 推荐(0) 编辑
摘要: SimpleTopology.javaView Code import backtype.storm.Config;import backtype.storm.LocalCluster;import backtype.storm.StormSubmitter;import backtype.storm.topology.TopologyBuilder;import backtype.storm.tuple.Fields;/** * Hello world! * */public class SimpleTopology{ public static void main( String[]... 阅读全文
posted @ 2013-03-04 18:17 涛光 阅读(1307) 评论(0) 推荐(0) 编辑
摘要: 在php中可以很方便的通过array_chunk 进行大数组的切割操作,但是在python中目前貌似没有可以直接使用的方法,下面是在网上搜索了一番,找到一个不错的解决办法,是利用python的生成器(yield)方法实现。具体的代码如下:def iterator_chunk(iterator, size, strict=False): rt = [] for it in iterator: rt.append(it) if len(rt) == size: yield tuple(rt) rt = [] ... 阅读全文
posted @ 2013-03-04 11:42 涛光 阅读(640) 评论(0) 推荐(0) 编辑
摘要: 在cygwin下出现:error: error setting certificate verify locations: CAfile: /usr/ssl/certs/ca-bundle.crt CApath: none while accessing https://github.com/apache/zookeeper.git/info/refsfatal: HTTP request failed这个是由于没有安装证书所致,需要重新运行cygwin的setup.exe文件,选择 :ca-certificates 包进行安装即可 阅读全文
posted @ 2013-01-27 07:00 涛光 阅读(1423) 评论(0) 推荐(0) 编辑
摘要: map 函数是将将一个字段指定范围内的值进行映射转换为目标值常见的用法有:map(x,min,max,target)和map(x,min,max,target,other)两种例如:map(x,0,0,1) 在函数参数中的x如果为0时则将其值映射为1,这在处理默认值为0时很有用。map(x,10,100,1,2) 在函数参数中的x如果落在[10,100]之间,则将x的值映射为1,否则将其值映射为2 使用方法:一般用作排序sort=sum(value,map(age,10,10,$x,$y))+asc&x=2&y=3 上面是将age字段值为10,则将其值映射为2,否则为3,然后加 阅读全文
posted @ 2013-01-16 09:52 涛光 阅读(3284) 评论(0) 推荐(0) 编辑
摘要: 在安装 mysql-python时,会出现:sh: mysql_config: not foundTraceback (most recent call last): File "setup.py", line 15, in <module> metadata, options = get_config() File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config libs = mysql_config("libs 阅读全文
posted @ 2012-12-12 11:31 涛光 阅读(78342) 评论(3) 推荐(7) 编辑
摘要: python下实现多线程有两种方式:一种是通过函数的方式产生新的线程,另外一种是通过面向对象的方式实现通过调用thread模块中的start_new_thread()函数来产生新线程#!/usr/bin/env python#encoding:utf-8#author:zhxiaimport threadimport timethread_count=0;def test(num,interval): for x in xrange(1,10): print 'current thread is:%d,and x is:%d'%(num,x) ... 阅读全文
posted @ 2012-12-11 13:12 涛光 阅读(605) 评论(0) 推荐(0) 编辑
摘要: 在python中,全局变量一般有两种使用方式:第一种:是在一个单独的模块中定义好,然后在需要使用的全局模块中将定义的全局变量模块导入。第二种:直接在当前的模块中定义好,然后直接在本模块中通过global声明,然后使用具体的方法如下所示:第一种:SOLR_URL='http://solr.org'def tt(): global SOLR_URL SOLR_URL=SOLR_URL+'#aa'if __name__=='__main__': tt() print SOLR_URL#输出:http://solr.org#aaPS:在此种用法中,如果我 阅读全文
posted @ 2012-12-11 13:11 涛光 阅读(125600) 评论(3) 推荐(2) 编辑
摘要: 下载最新的tomcat文件,并解压,假设目录为:/home/user/apps/tomcatbinconflibLICENSElogsNOTICERELEASE-NOTESRUNNING.txttempwebappswork然后新建一个目录:/home/user/apps/tomcat_instances,其下结构为:share (共享脚本) :这个下面只有一个inc.sh文件,设置一些基本的环境变量job_server(一个tomcat实例,可以建n多个)inc.sh#!/bin/echo Warining,this library should be sourced!export CATA 阅读全文
posted @ 2012-12-07 09:50 涛光 阅读(1526) 评论(0) 推荐(0) 编辑
摘要: 以下是对信号量的处理函数,用于进程间通信(IPC)sem_acquire — Acquire a semaphoresem_get — Get a semaphore idsem_release — Release a semaphoresem_remove — Remove a semaphore$key=ftok(__FILE__,'t');$seg_id=sem_get($key); //获取一个信号idsem_acquire($seg_id); //取的信号//do somethingsem_release($seg_id); //释放信号量sem_remove($se 阅读全文
posted @ 2012-11-23 09:31 涛光 阅读(469) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页