qiuqiang1985的博客
qiuqiang1985 · 共 16 篇文章
java中,如何安全的结束一个正在运行的线程?
转 http://blog.tianya.cn/blogger/post_read.asp?BlogID=3668353&PostID=32699671 问题 Java中提供了很多调度线程的方法,上一节介绍了其中一种控制线程的方法:如何等待一个线程结束。那么如果不希望等待线程结束,而是根据问题的需要随时都要中断线程使其结束,这种对线程的控制方法该如何实现呢? 解决思路 首先必须先明确“中断”这个概念的实际含义,这里的中断是指一个线程在其任务完成之前被强行停止,提前消亡的过程。查阅JDK的帮助文档,可以找到这样一个和中断有关的方法:interrupt()。 它的语法格式如下所示: public…
2012-11-08T16:56:40Z · 编程语言 · 评论(0)
shell 日期加减,日期大小比较的方法
转: http://www.mysqlinfo.com/2012/04/22/shell-%E6%97%A5%E6%9C%9F%E5%8A%A0%E5%87%8F%EF%BC%8C%E6%97%A5%E6%9C%9F%E5%A4%A7%E5%B0%8F%E6%AF%94%E8%BE%83%E7%9A%84%E6%96%B9%E6%B3%95/ 1 日期加减方法 可实现当天的日期加减,指定日期的加减,天周月年。 $ date -d "+1 day" +%Y-%m-%d 2012-04-23 $ date -d "-1 day" +%Y-%m-%d 2012-04-21 $ date -d "2…
2012-08-21T16:59:09Z · 开源软件 · 评论(0)
rsync 拷贝数据
rsync -av -e ssh username@oldserverhost:/home/old_home/ /home/new_home/
2012-08-16T09:41:19Z · 编程语言 · 评论(0)
Fast Intersection of Sorted Lists Using SSE Instructions
转: http://highlyscalable.wordpress.com/2012/06/05/fast-intersection-sorted-lists-sse/ Intersection of sorted lists is a cornerstone operation in many applications including search engines and databases because indexes are often implemented using different types of sorted structures. At GridDynamics…
2012-08-14T09:27:57Z · 编程语言 · 评论(0)
Probabilistic Data Structures for Web Analytics and Data Mining
转: http://highlyscalable.wordpress.com/2012/05/01/probabilistic-structures-web-analytics-data-mining/ Statistical analysis and mining of huge multi-terabyte data sets is a common task nowadays, especially in the areas like web analytics and Internet advertising. Analysis of such large data sets oft…
2012-08-14T08:58:39Z · 非技术 · 评论(0)
Tricks with Direct Memory Access in Java
转: http://highlyscalable.wordpress.com/2012/02/02/direct-memory-access-in-java/ Java was initially designed as a safe, managed environment. Nevertheless, Java HotSpot VM contains a “backdoor” that provides a number of low-level operations to manipulate memory and threads directly. This backdoor – s…
2012-08-14T08:37:27Z · 编程语言 · 评论(0)
linux下网卡buffer size修改
在网上找一些文章,是因为网卡buffer size太小(This is a count of packets that have been dropped by the kernel, either due to a firewall configuration or due to a lack of network buffers.),那我们就只有调整网卡buffersize,找了一些国外的文章,可以通过ethtool来修改网卡的buffer size ,首先要网卡支持,由于是NAT设备,我的全部是INTEL 的1000M网卡 我们看看ethtool说明 -g –show-ring Que…
2012-08-10T09:47:41Z · 互联网 · 评论(0)
ArrayWritable的使用方式
ArrayWritable is a touch hard to use. Say you have an array of IntWritable[]. The get() method or ArrayWritable, after serializations/deserialization, does in fact return an array of type Writable. As such you cannot cast it directly to IntWritable[]. Individual elements are of type IntWritable and…
2012-08-06T10:20:49Z · 编程语言 · 评论(0)
flume之退避算法backoff algorithm
什么是退避算法: In a single channel contention based medium access control (MAC) protocols, whenever more than one station or node tries to access the medium at the same instant of time, it leads to packet collisions. If the collided stations tries to access the channel again, the packets will collide as …
2012-05-06T11:11:16Z · 开源软件 · 评论(0)
flume提交配置分析
Flume是一个分布式的日志收集系统,提供了很好的配置管理。今天分析一下页面提交配置的详细过程。 1,前台部分,首先,在flumeconfig.jsp页面中,提供了配置管理的表单,详细如下, <h2>Configure a single node</h2> <form method=post action="command.jsp"> <table> <tr> <td>Configure node:</td> <td> <select name="nodeChoice"> <option value="">Choose from list</option> <% for (String s …
2012-05-03T08:32:32Z · 开源软件 · 评论(0)
使用Maven2快速创建项目
源地址:http://www.intellij.org.cn/portal/index.php?option=com_content&task=view&id=26&Itemid=28 1、构建单个工程 Maven2在项目管理方面影响越来越大,很多项目都使用Maven2。下面我们就介绍如何使用Maven2快速创建项目原型,然后在此基础上进行项目开发。下面我们就看一下如何使用Maven2创建典型的三类项目: 普通的Java项目,如基础包等: mvn archetype:create -DgroupId=com.yourcompany -DartifactId=myproject -Darche…
2012-04-25T21:08:05Z · 研发管理 · 评论(0)
在ubuntu下使用eclipse+maven2管理和开发项目
(1)安装maven2 sudo apt-get install maven2 (2)在eclipse中配置安装好的maven2 不使用eclipse嵌入的MAVEN,添加外部MAVEN Windows|Perferences|Installation|Embedded Maven|Add...|M2_HOME|打勾|应用|确定 (3)创建项目 mvn archetype:generate -DgroupId=cn.bisoft.java.app -DartifactId=s2si -DarchetypeArtifactId=maven-archetype-quickstart -Dinte…
2012-04-25T20:59:24Z · 研发管理 · 评论(0)
Getting started with Avro RPC
转: http://gbif.blogspot.com/2011/06/getting-started-with-avro-rpc.html Getting started with Avro RPC Apache Avro is a data exchange format started by Doug Cutting of Lucene and Hadoop fame. A good introduction to Avro is on the cloudera blog so an introduction is not the intention of this post. Avr…
2012-04-25T09:54:26Z · 开源软件 · 评论(0)
Java模拟异步消息的发送与回调
转--- http://kt8668.iteye.com/blog/205739 本文的目的并不是介绍使用的什么技术,而是重点阐述其实现原理。 一、 异步和同步 讲通俗点,异步就是不需要等当前执行的动作完成,就可以继续执行后面的动作。 通常一个程序执行的顺序是:从上到下,依次执行。后面的动作必须等前面动作执行完成以后方可执行。这就是和异步相对的一个概念——同步。 案例: A、张三打电话给李四,让李四帮忙写份材料。 B、李四接到电话的时候,手上有自己的工作要处理,但他答应张三,忙完手上的工作后马上帮张三写好材料,并传真给张三。 C、通完电话后,张三外出办事。 说明: 张三给李四通完电话后,就出…
2012-02-08T00:33:13Z · 编程语言 · 评论(0)
iconv的编码转换原理[转]
更广义的字符集转换:iconv 在先前的章节中,我们已见到了两组 mbs 与 wcs 互转的函式,第一组对于有「状态改变」的编码系统 mbs 无法做到字符串的状态控制,故不适合做该 mbs 的转换工作;而第二组则可以直接做字符串的状态控制,故使用范围就更广了。然而,这两组字符串转换函式在某些使用场合下都有很大的限制,广义而言,它们都属于「字符集转换函式」,然而它们都直接与 I18N、locale 机制绑在一起,也就是说在使用它们之前,程序都必须设好正确的 locale 才行。故在以下的情况使用它们就会很不方便,甚至根本行不通: " 如果程序中需要做 A 字集编码与 B 字集编码的转换时,不幸…
2011-12-01T23:57:23Z · 编程语言 · 评论(0)