A little bit more...

Wednesday, March 21, 2007

newClasspathContainerEntry

Introduction

Setting Java project build path involves setting classpaths of the project which are different from the Java runtime classpath. In JDT classpaths are represented with classpath entries which roughly fall into five kinds: source folder entries, binary library entries, prerequisite project entries, classpath variables, and classpath containers.

Start you eclipse JDT, open a Java project and launch the build path configuration window, and you’ll find all the options enabling you to add/remove all kinds of classpath entries. The frequently used JAVA_HOME system variable (under Windows) can be considered as a classpath variable here. And for a classpath container, hereafter comes more.

Classpath Container

Conceptually it is a data structure which represents a set of tupes with each in the form of . An instance of this data structure can be referenced as an instance of IClasspathEntry which wrapped a unique path of type IPath called a container path. It is noteworthy that all kinds of classpath entries mentioned above are represented by instances of IClasspathEntry within which there is a field called kind identifying the kind of entries. And also, it is noteworthy that an instance of ClasspathContainer is not an instance of IClasspathEntry of kind container. Simply speaking, each instance of IClasspathEntry of kind container references as its member field a container path which uniquely identifies an instance of the data structure mentioned above which contains (or references) a set of instances of ClasspathContainer. Actually, it’s still a little complicated. But that’s it. Below is sketched the relationship.

IClasspathEntry(kind: container)-aContainerPath –> , …}>.

Ways of Creating Classpath Container Entries

The implementation details are more complicated. Class or interfaces involved in include JavaModelManager, JavaCore, IClasspathEntry, ClassContainer, IClassContainerInitializer, and other Java Model classes. The set of tupes of the form of are maintained in JavaModelManager.

Generally, there’re two ways of creating a classpath container entry. The 1st way is to hard code creating instances of ClasspathContainer, and the 2nd way is to create instances of ClasspathContainer via the lazily invoked classpath container initializer which you may define onto the extension point org.eclipse.jdt.core.classpathContainerInitializer.

The hard code way:

// create an instance of IClasspathEntry of kind CPE_CONTAINER
// but ClasspathContainer associated to this entry are not yet defined.
JavaCore.newContainerEntry(..);

// Create and set the classpath container
JavaCore.setClasspathContainer(..);

// Put container path, containers and projects into hashmaps.
// Invoked in JavaCore.setClasspathContainer(..).
JavaModelManager.containerPut(..)

The initializer way:

// Contribute an extension to the initializer extension point.

When classpath entries contained in containers get resolved, the execution process is:

// Methods resolving classpath entries will get method getClasspathContainer(..) invoked.
JavaCore.getClasspathContainer(..);

JavaModelManager.getClasspathContainer(..);

// Both ways would get this method invoked.
JavaModelManager.containerGet(..);

// The initializer way would get this method invoked,
// within which initializer extension(s) will be lazily invoked.
JavaModelManager.initializeAllContainers(..);
or JavaModelManager.initializeContainer(..);

Resources

  1. Setting the Java build path
  2. JDT 3.2 Source Codes.

Technorati : , , , ,

Eclipse CDT CPU Usage 100% Solution

Solution

总的来说是把你的Eclipse使用的JRE换成6.0(早就download在机器上居然没有发现,2006.12.12就final release了,改成open source之后发布的速度快多了,现在都build100+了)的或者IBM的5.0实现,看别人的blog说是Sun的实现6.0以下有bug和 CDT不兼容,我试了BEA的Jrockit5,也是有问题。

换成6.0后,Indexer和Content Assist都没有问题了,不会CPU100%了。

另外,不像[1]里面说的CDT3.0才有问题,最新的CDT3.1.2也还是有这个问题。

Bonus Knowledge

Use something like “-vmargs -Xmx256M” when launching eclipse to use more memory.

Resources

  1. Bugzilla Bug 108242 Full Indexer in CDT3.0 extremely slow or does not work
  2. Eclipse3.2.1中使用CDT经常CPU100%问题的解决方法
  3. Eclipse CDT开发C++速度慢的解决方法
  4. CDT Indexer导致CPU 100%的解决办法
  5. Eclipse+cdt+MinGW 建立C++工程問題


Technorati : , ,
Del.icio.us : , ,
Ice Rocket : , ,
Flickr : , ,
Zooomr : , ,
Buzznet : , ,

Friday, March 16, 2007

Workshops of AOSD'07

Refer to here for all the workshops held at AOSD'07.

Below are the ones that I'm sepecially interested in:

The workshop I'm intersted the most, but not appearing at AOSD'07 is Modeling and Analysis of Concerns in Software .

Thursday, March 15, 2007

AOSD'07 "Report" - By others

Blog Posts About AOSD'07:

  • AOSD Demo a success:Can't figure out what exactly the demo is from this post. I guess it is a eclipse plug-in facilitating jps indicating.
  • AOSD Conference Day 1:About Glassbox, overhead of load-time weaving, possible usage of AOP for run-time verification/debugging, comment on the keynote "Building Robust System", etc.
update (22/03/2007):

No more...

It seems the academic people are too busy to blog. There are few posts about the conference.

Blog APIs

Resources:

  1. Getting Started with the MetaWeblog API for Windows Live Spaces
  2. Blogger Data API Developer’s Guide
  3. More…


Technorati : , ,
Del.icio.us : , ,
Ice Rocket : , ,
Flickr : , ,
Zooomr : , ,
Buzznet : , ,

Wednesday, March 14, 2007

URI, URL and Java

This post basically is a collection of resources.

1. What're URI, URN and URL?

A URI is a uniform resources identifier reference. A URL is a uniform resource locator. URNs name resources but do not specify how to locate them. The mailto, news, and isbn URIs shown above are examples of URNs. URLs and URNs both fall into URIs. But normally URNs and URLs doesn't interset. Refer to RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax for the syntax of a URI instance. And the java class description of URI gives a very good summary of URI, besides providing some useful resources.

2. Syntax

Below is a little breakdown on the syntax of URI, which is directly taken from the priviously mentioned JAVA API spec.

At the highest level a URI reference (hereinafter simply "URI") in string form has the syntax:

[scheme:] scheme-specific-part [#fragment]

where square brackets [...] delineate optional components and the characters : and # stand for themselves. With a further breakdown on scheme-specific-part we can get a URI in the string form:

[scheme:] [//authority][path][?query] [#fragment]

where the characters :, /, ?, and # stand for themselves. With a further breakdown on authority we can get a more general form:

[scheme:] [// [user-info@]host[:port] ] [path] [?query] [#fragment]

where the characters @ and : stand for themselves.

Note: a scheme of a URL is called a protocol, such as "http" and "ftp".

3. Examples

An opaque URI is an absolute URI whose scheme-specific part does not begin with a slash character ('/'). Opaque URIs are not subject to further parsing. Some examples of opaque URIs are:

mailto:java-net@java.sun.com /*URN*/
news:comp.lang.java /*URN*/
urn:isbn:096139210x /*URN*/

A hierarchical URI is either an absolute URI whose scheme-specific part begins with a slash character, or a relative URI, that is, a URI that does not specify a scheme. Some examples of hierarchical URIs are:

http://java.sun.com/j2se/1.3/ /*URL*/
docs/guide/collections/designfaq.html#28
../../../demo/jfc/SwingSet2/src/SwingSet2.java
file:///~/calendar

Also URIs are categorized as absolute URIs and relative URIs. An absolute URI specifies a scheme, and a URI that is not absolute is called a relative URI.

Among above examples comments in the form of "/*...*/" tell which are URLs and which are URNs.

4. Character categories

As specified in resources accessible, we quote some that matters:

RFC 2396 specifies precisely which characters are permitted in the various components of a URI reference. The following categories, most of which are taken from that specification, are used below to describe these constraints:
alphaThe US-ASCII alphabetic characters, 'A' through 'Z' and 'a' through 'z'
digitThe US-ASCII decimal digit characters, '0' through '9'
alphanumAll alpha and digit characters
unreservedAll alphanum characters together with those in the string "_-!.~'()*"
punctThe characters in the string ",;:$&+="
reservedAll punct characters together with those in the string "?/[]@"
escapedEscaped octets, that is, triplets consisting of the percent character ('%') followed by two hexadecimal digits ('0'-'9', 'A'-'F', and 'a'-'f')
otherThe Unicode characters that are not in the US-ASCII character set, are not control characters (according to the Character.isISOControl method), and are not space characters (according to the Character.isSpaceChar method) (Deviation from RFC 2396, which is limited to US-ASCII)

The set of all legal URI characters consists of the unreserved, reserved, escaped, and other characters.

Escaped octets, quotation, encoding, and decoding


RFC 2396 allows escaped octets to appear in the user-info, path, query, and fragment components. Escaping serves two purposes in URIs:
  • To encode non-US-ASCII characters when a URI is required to conform strictly to RFC 2396 by not containing any other characters.

  • To quote characters that are otherwise illegal in a component. The user-info, path, query, and fragment components differ slightly in terms of which characters are considered legal and illegal.
These purposes are served in this class by three related operations:
  • A character is encoded by replacing it with the sequence of escaped octets that represent that character in the UTF-8 character set. The Euro currency symbol ('\u20AC'), for example, is encoded as "%E2%82%AC". (Deviation from RFC 2396, which does not specify any particular character set.)

  • An illegal character is quoted simply by encoding it. The space character, for example, is quoted by replacing it with "%20". UTF-8 contains US-ASCII, hence for US-ASCII characters this transformation has exactly the effect required by RFC 2396.

  • A sequence of escaped octets is decoded by replacing it with the sequence of characters that it represents in the UTF-8 character set. UTF-8 contains US-ASCII, hence decoding has the effect of de-quoting any quoted US-ASCII characters as well as that of decoding any encoded non-US-ASCII characters. If a decoding error occurs when decoding the escaped octets then the erroneous octets are replaced by '\uFFFD', the Unicode replacement character.
5. Java Impl.

URI, URL, URLClassLoader, URLConnection, URLDecoder, URLEncoder and URLStreamHandler, which are all located in package java.net.

Resources:
  1. Uniform Resource Identifiers (URI): Generic Syntax

  2. Format for Literal IPv6 Addresses in URL's

  3. JavaTM 2 Platform Standard Edition 5.0 API Specification
Technorati : , , ,
Del.icio.us : , , ,

Sunday, March 04, 2007

服务器租借与托管资料收集

(本文仅仅为资料收集,不存在原创内容)

1. 名词解释

1U-4U:

U(英文中的Unit?不知道)代表架式服务器的高度,1U=1.75英寸=4.45厘米。同样的2U=4*1.75英寸=4*4.45厘米,以此类推。

机柜:

一般多个机架服务器安装在一个机柜内,一个普通机柜的高度是42U。

ICP:

ICP(Internet Content Provider)证的全称:《中华人民共和国电信与信息服务业务经营许可证》即ICP证,通过互联网向上网用户提供有偿信息、网上广告、代制作网页、电 子商务及其它网上应用服务的公司必须办理的网络经营许可证。国家对经营性网站实行ICP证制度,注册资金应在100万或者100万以上的公司才能办理 ICP证,一经办理一般能在该省的通信管理局的网站查询到。同时对从事非经营性活动的网站要进行ICP备案,简称为ICP备。

2. 服务器的种类

首先,我们必需了解何谓PC服务器?所谓PC服务器(下文讨论的多为PC服务器),即是Intel架构服务器,与一些大型服务器如 Mainframe, Unix架构服务器等不同,前者大多运行Windows或Linux等操作系统,使用较为普遍,后者多为专业用途,如银行,大型制造业,物流业,证券…等 行业使用,一般人较少有机会接触到.

可以按照各种标准进行分类,按应用层次分为:入门级服务器、工作组级服务器、部门级服务器和企业级服务器;按处理器架构分为:CISC (Complex Instruction Set Computer)架构服务器、RISC(Reduced Instruction Set Computing)架构服务器和VLIW(Very Long Instruction Word超长指令集架构)架构服务器;按用途分为:通用型服务器和专用型服务器,或者WEB服务器、E-mail服务器、数据服务器、DNS服务器等等; 按机箱结构分为:台式(塔式)服务器、机架服务器、机柜服务器和刀片式(bladed)服务器。

2.1 塔式服务器

优点:服务器的主板扩展性较强、插槽也多,可以进行硬盘和电源的冗余扩展,对环境要求较低,原则上不用和机柜搭配使用,价格也相对较低,集多种常见的服务和应用于一身。

缺点:塔式服务器长得跟我们平时用的台式机一样,占用空间比较大,适合小型企业自己维护,不适合放在服务器托管商那里托管,独立性太强,协同工作在空间占用和系统管理上都不方便,在一些应用要求较高的企业中,这种单机服务器无法满足要求。

2.2 机架服务器

机架式(RACK)服务器长得像卧着的台式机,可以一台一台地放到固定机架上,因此而得名。机架服务器一般采用标准19英寸的宽度设计,其高度按照一定的单位高度的设计,其单位为U,约为4.54cm。

优点:机架是服务器的机箱宽度都是相同的,可以在标准的机柜中存放服务器,减少服务器产品对空间的要求,易于服务器的集中管理。所以机架服务器便于放在服务器托管商那里托管。

缺点: 购买价格相对较高,比同等配置的塔式服务器价格要高20%-30%,1U以上服务器服务器托管费用较高。由于在空间上非常紧凑,所以在扩展性和散热方面上具有一定限制,一般无法实现太完整的设备扩展,所以单机性能相对比较有限。

2.3 刀片式服务器

3. 服务器的购买和租借

一般服务器或者自行购买然后放到IDC(Internet Data Center)服务提供商的机房托管,或者租借IDC服务商的。租借的服务器一般IDC服务提供商都会负责托管,租借又分为送产权和不送产权两种,送产权 的即租用一定时间(如1年或者2年)后服务器的产权归用户。需要指出的是租用的服务器大多数不是新的服务器,而是旧的组装服务器,当然也有宣称租用品牌服 务器的IDC服务商。

下面主要说说PC服务器的基本硬件配置常识。主要的服务器国际生产商有:IBM,HP,Dell,Sun(最近也推出X86服务器产品),超微等; 国内生产商主要有:曙光、联想、浪潮、方正、清华同方、华硕等;服务器芯片生产商主要是:Intel和AMD;服务器芯片主要有:Pentium 4(单路)、Itanium(安腾,64位,Dual-Core)Xeon(至强,双路)、XeonMP(Multi Processing Platform,四路)、AthlonMP(速龙MP)、Opteron(皓龙,64位,100系列是单路,200系列是双路,800系列是四路和八 路)。

4. 托管服务器的流程

4.1 选择托管服务器的类型

购买全新服务器,或向服务器托管商租借。

4.2 选择服务器托管商

考察服务商、机房,最好能去现场考察,以检查其设施是否齐全。

4.3 签订托管合同

如果是自己购买的服务器,则需要运送服务器到托管商指定的机房,最后签订详细的托管合同。

5. 经验

5.1 最好不要异地托管

如果是自己购买的服务器最好不要找异地托管,因为时候要对服务器进行本地维护。

5.2 带宽保证

不管是独享带宽还是共享带宽,实际使用的带宽一般不会超过10M,甚至5M甚至更低,各地的IDC都会有限制。

5.3 ICP证

一定要检查托管商是否有ICP证。

6. 业界案例

豆瓣网,土豆网,劲舞团等等。

7. 上海的服务商简介

中国E动网www.edong.com

8. 其他

www.linkwan.com/vr ,用来测试机房速度和当前连接的路由节点。

参考资料:

  1. 首次托管服务器经验
  2. 服务器结构中的1U 2U 3U是什么意思?
  3. 机架式服务器和塔式服务器的区别
  4. 服务器有哪些种类?
  5. 典型用户案例
  6. 什么是机架式服务器?
  7. BananaSkin(持续关注IDC方面的博客)
  8. 服务器有关的Post(123)(豆瓣blog
  9. 如何挑选服务器?哪个牌子的最好?(1万元以下的)
  10. 关于”个人网站申请备案”经验
  11. 业内人士教您如何选择IDC
  12. 服务器托管—你会选1U还是2U服务器?
  13. ICP专栏:介绍ICP相关知识,ICP申请、ICP备案流程及所须资料等
  14. 【转载】教你如何租服务器和选择机房
  15. 差价缩小:现在你考虑1U还是2U?
  16. 中国IDC产业发展调查暨年度大典官方网站
  17. 找小说网正式拥有属于自己的服务器

About Me

My photo
I'm finishing my master degree in Software Engineering, Computer Science. I believe and have been following what Forrest Gump's Mam said: you have to do the best with what god gave you.