随笔分类 -  Java ...

摘要:JS中的phototype是JS中比较难理解的一个部分本文基于下面几个知识点:1 原型法设计模式在.Net中可以使用clone()来实现原型法原型法的主要思想是,现在有1个类A,我想要创建一个类B,这个类是以A为原型的,并且能进行扩展。我们称B的原型为A。2 javascript的方法可以分为三类:... 阅读全文
posted @ 2014-08-09 14:41 Qiengo 阅读(118) 评论(0) 推荐(0)
摘要:1、首先是Tomcat的获取和安装。 获取当然得上Apache的官方网站下载,开源免费,而且带宽也足够。下载会很快。 这是两种不同的下载,一个是普通安装版本,一个是解压安装版本。使用起来是一样的,只是在普通安装版本中有一些界面可提供对Tomcat的快捷设置,而且普通安装会将Tom... 阅读全文
posted @ 2014-07-12 10:06 Qiengo 阅读(191) 评论(0) 推荐(0)
摘要:java移位运算符不外乎就这三种:>(带符号右移)和>>>(无符号右移)。1、 左移运算符> num右移的规则只记住一点:符号位不变,左边补上符号位2)运算规则按二进制形式把所有的数字向右移动对应的位数,低位移出(舍弃),高位的空位补符号位,即正数补零,负数补1当右移的运算数是byte 和short... 阅读全文
posted @ 2014-04-17 15:48 Qiengo 阅读(526) 评论(0) 推荐(0)
摘要:1.下载JDK,安装官网下载地址:http://java.sun.com/javase/downloads/index.jsp下载后,安装,选择你想把JDK安装的目录:比如:JDK安装目录:E:\java其他博文有说还要装JRE,其实JDK安装好了,就不需要安装JRE了,本身就有了。2.设置JDK环境变量右击“计算机”,点击“属性”,点击弹出界面的左部分的“高级系统设置”,选择“高级”选项卡,点击下部的“环境变量”新建2个变量,编辑1个变量,分别填入以下信息,如图所示:新建:变量名:JAVA_HOME变量值:你的JDK安装目录\jdk1.7.0变量名:CLASSPATH变量值:.;%JAVA_ 阅读全文
posted @ 2013-07-23 12:03 Qiengo 阅读(265) 评论(0) 推荐(0)
摘要:DefinitionsAnintis aprimitive. It isnotanObject. Anintis a high performance, streamlined beast for calculating numbers in the range -2,147,483,648 [-231] aka Integer.MIN_VALUE to +2,147,483,647 [231-1] aka Integer.MAX_VALUE. Anintis a bare bones32-bitchunk of information.intvariables aremutable. Unl 阅读全文
posted @ 2012-12-24 11:08 Qiengo 阅读(354) 评论(0) 推荐(0)
摘要:1.sleep()使当前线程(即调用该方法的线程)暂停执行一段时间,让其他线程有机会继续执行,但它并不释放对象锁。也就是如果有Synchronized同步块,其他线程仍然不同访问共享数据。注意该方法要捕获异常比如有两个线程同时执行(没有Synchronized),一个线程优先级为MAX_PRIORITY,另一个为MIN_PRIORITY,如果没有Sleep()方法,只有高优先级的线程执行完成后,低优先级的线程才能执行;但当高优先级的线程sleep(5000)后,低优先级就有机会执行了。总之,sleep()可以使低优先级的线程得到执行的机会,当然也可以让同优先级、高优先级的线程有执行的机会。2. 阅读全文
posted @ 2012-12-21 16:24 Qiengo 阅读(246) 评论(0) 推荐(0)
摘要:BlockingQueueArrayBlockingQueueDelayQueueLinkedBlockingQueuePriorityBlockingQueueSynchronousQueueBlockingDequeLinkedBlockingDequeBlockingQueueTheBlockingQueueinterface in thejava.util.concurrentclass represents a queue which is thread safe to put into, and take instances from. In this text I will sh 阅读全文
posted @ 2012-12-19 15:02 Qiengo 阅读(3080) 评论(0) 推荐(0)
摘要:o(∩_∩)oString result = String.format("The format method is %s!", "great");// result now equals "The format method is great!".You don't need to use numbers to indicate positioning. By default, the position of the argument is simply the order in which it appears in th 阅读全文
posted @ 2012-12-11 12:20 Qiengo 阅读(1112) 评论(0) 推荐(1)
摘要:Label DecorationsMenu ActionsUser Guidehttp://wiki.eclipse.org/EGit/User_GuideLabel DecorationsLabel decorations show Git specific information on resources under Git version control. They appear in all views showing model objects, like Package Explorer, Project Explorer, Navigator, Hierarchy View.Th 阅读全文
posted @ 2012-11-21 17:57 Qiengo 阅读(2300) 评论(0) 推荐(0)
摘要:Type the "egit" in the Install New Software interface of Eclipse,and select the address prompt:Now ,you found that there are two git,EGit and JGit.After googling them,you may know that the Jgit is the dependence of the Egit,so you have to install the Jgit also.If youencounter problems whtn 阅读全文
posted @ 2012-11-20 11:39 Qiengo 阅读(244) 评论(0) 推荐(0)
摘要:A*(读作A星)算法对初学者可能略显复杂.虽然网络上已经有很多讲解A*算法的文章,但大多数都是为那些已经具备基础知识的人写的.而本文特为真正新手准备.本文并不是要给出这个问题的终极篇,而是阐述一些基础问题,帮你做好拓展阅读的准备,能真正明白他们在说什么.文章最后给出了其中佼佼者的链接供继续阅读.最后一点,本文并非针对具体方案.你可以把这里讨论的东西转换成任何计算机语言实现.正如你所期望的,文章最后给出了示例代码的下载链接.该示例程序包含C++和Blitz Basic两个版本.如果你仅仅想看一下效果A*算法的执行效果,里面有可执行文件.我们正在超越自己.我们开始…入门:搜索区假设有一个人要从A点 阅读全文
posted @ 2012-09-02 12:14 Qiengo 阅读(1022) 评论(0) 推荐(0)
摘要:1.use html tag to format the texthttp://www.cnblogs.com/ffvsff/archive/2008/02/17/1071504.html<br> new line<pre> can maintain the space the tab of you text 阅读全文
posted @ 2012-08-25 10:11 Qiengo 阅读(112) 评论(0) 推荐(0)
摘要:1. For Integer,you can consider the following: *2 ≡ <<1 /2≡>>1 %2 ≡ &12.Generate anon-repeating numbers random arrayranging from 1-50 int[] result = new int[50]; ArrayList<Integer> numPool = new ArrayList<Integer>(); for (int i = 0; i < 50; i++) { numPool.add(i); ... 阅读全文
posted @ 2012-08-14 10:45 Qiengo 阅读(133) 评论(0) 推荐(0)
摘要:1.j***Array<->***[] (c++,not C)you can use jsize theArrayLength = env->GetArrayLength(arraySrc);to get the length of the array;jbyteArray->BYTE[] #define BYTE unsigned charjbyte * arrayTemp=env->GetByteArrayElements(arraySrc,0);//arraySrc is jbyteArray BYTE *arrayRet= (BYTE *)arrayTem 阅读全文
posted @ 2012-07-27 17:57 Qiengo 阅读(1276) 评论(0) 推荐(0)
摘要:java:package com.nan.callback;import android.app.Activity;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.View;import android.widget.Button;import android.widget.TextView;public class MyCallbackActivity extends Activity{ private Button intButton = ... 阅读全文
posted @ 2012-07-20 17:42 Qiengo 阅读(661) 评论(0) 推荐(0)
摘要:For example :List<? extends HasWord> wordList = toke.tokenize();?extendsHasWordmeans "A class that extendsHasWord." In other words,HasWorditself or any of its children... basically anything that would work withinstanceof HasWord.In more technical terms,? extends HasWordis a bounded w 阅读全文
posted @ 2012-07-16 12:33 Qiengo 阅读(302) 评论(0) 推荐(0)
摘要:JNI是Java Native Interface的 缩写。从Java 1.1开始,Java Native Interface (JNI)标准成为java平台的一部分,它允许Java代码和其他语言写的代码进行交互。JNI一开始是为了本地已编译语言,尤其是C和C++而设计 的,但是它并不妨碍你使用其他语言,只要调用约定受支持就可以了。 使用java与本地已编译的代码交互,通常会丧失平台可移植性。但是,有些情况下这样做是可以接受的,甚至是必须的,比如,使用一些旧的库,与硬件、操作系统进行交互,或者为了提高程序的性能。JNI标准至少保证本地代码能工作在任何Java 虚拟机实现下。JNI(Java N 阅读全文
posted @ 2012-06-26 11:31 Qiengo 阅读(273) 评论(0) 推荐(0)
摘要:By冲出宇宙From傲尔科技(www.hour41.com)时间:2006-11-17注:转载请注明作者和单位。Java语言标准从1996年发布第一版,到2000年发布第二版,再到2004年发布第三版,java语言已经经过了3次大的扩充和改进。功能是越来越多,操作是越来越复杂。显然,性能问题也就越来越突出。本文将力图从java本身分析优化java代码的各种可能。文章的数据未经特别说明,均来自于jdk5.0版本。1 Java基本数据类型时间分析因为单独测试一个基本类型的变量很不精确,无论你怎么测,误差都很大。所以,我们只能大致的给出速度上的差别。变量的访问速度和访问的类型是有很大关系的,一般我们 阅读全文
posted @ 2012-06-26 10:34 Qiengo 阅读(542) 评论(0) 推荐(0)
摘要:运算符优先级表优先级运算符结合性1()[].从左到右2!+(正) -(负)~++--从右向左3*/%从左向右4+(加)-(减)从左向右5<<>>>>>从左向右6<<=>>=instanceof从左向右7== !=从左向右8&(按位与)从左向右9^从左向右10|从左向右11&&从左向右12||从左向右13?:从右向左14=+=-=*=/=%=&=|=^= ~= <<=>>= >>>=从右向左说明: 1、该表中优先级按照从高到低的顺序书写,也就是优先级为1的优 阅读全文
posted @ 2012-06-23 10:55 Qiengo 阅读(282) 评论(0) 推荐(0)
摘要:对于基本类型来说,就是值拷贝,高位舍去或补0,低级类型转高级类型,高位补0,高级类型转低级类型,高位舍去对于引用类型,就是内部指针强行转换(int)cache & ((1 << bits) - 1) process the & first! 阅读全文
posted @ 2012-06-22 17:09 Qiengo 阅读(222) 评论(0) 推荐(0)