Friday, March 28, 2008

JRuby Resource

JRuby project home http://xircles.codehaus.org/projects/jruby

Svn of JRuby
http://svn.codehaus.org/jruby/

Svn of Activerecord-jdbc-adapter
http://jruby-extras.rubyforge.org/svn/trunk/activerecord-jdbc/

JRuby Mailing List:

dev@jruby.codehaus.org
user@jruby.codehaus.org


JRuby Activerecord-jdbc-adapter Issue Tracker: http://jira.codehaus.org/browse/JRUBY/component/12786

Activerecord-jdbc-adapter Documentation

Getting_Started with JRuby  http://wiki.jruby.org/wiki/Getting_Started

 

Cygwin的中文显示乱码问题:
    在Cygwin下,输出的中文系统信息经常显示为乱码,这是因为输出的字符编码设置有问题。可以在.bash_profile中添加如下环境变量来解决:
    export OUTPUT_CHARSET="cp936"

 

在cygwin中全新安装rubygem前必须:
   unset RUBYOPT
安装cygwin后默认设置了$RUBYOPT以指定ruby加载rubygems,但此时rubygems并未安装, 因崦执行ruby会报错.

Thursday, March 27, 2008

Apache Derby

 

What is Apache Derby?

Apache Derby, an Apache DB subproject, is an open source relational database implemented entirely in Java and available under the Apache License, Version 2.0. Some key advantages include:

  • Derby has a small footprint -- about 2 megabytes for the base engine and embedded JDBC driver.
  • Derby is based on the Java, JDBC, and SQL standards.
  • Derby provides an embedded JDBC driver that lets you embed Derby in any Java-based solution.
  • Derby also supports the more familiar client/server mode with the Derby Network Client JDBC driver and Derby Network Server.
  • Derby is easy to install, deploy, and use.

If you're new to Derby, check out the Quick Start page.

Apache Derby

Rubinius - Ruby Virtual Machine

http://rubini.us/

For Business

Rubinius is a project to develop the next generation virtual machine for the Ruby programming language.

Rubinius draws on the best virtual machine research and technology of the past 30 years and incorporates the newest research in dynamic language implementations. Rubinius implements the core libraries in Ruby, providing a system that is much more accessible, easier to develop and to extend.

The Rubinius compiler generates bytecode that you can distribute in easy-to-install packages similar to jar files. Other measures to protect intellectual property can be easily added.

For Developers

The Rubinius virtual machine is loosely based on the Smalltalk-80 architecture. The small virtual machine is presently implemented in C.

The Ruby core libraries are written in Ruby with some functionality provided by primitives written in C. There is also a foreign function interface (FFI) that enables describing and directly calling functions in system libraries. There is no need to use compiled bindings.

Rubinius has multiple concurrency primitives such as Channels, Actors, Tasks, and Threads. Rubinius is developed in the TDD/BDD style and we are concurrently writing a set of RSpec compatible specs for the Ruby core libraries. Rubinius is also an ideal platform to experiment with various cutting-edge technology like software transactional memory (STM).

If you are interested in contributing, visit the Rubinius project on Lighthouse.

Tuesday, March 25, 2008

唐诗宋词辑录

秦观

山抹微云,天连衰草,画角声断谯门。
暂停征棹,聊共引离尊。
多少蓬莱旧事,空回首、烟霭纷纷。
斜阳外,寒鸦万点,流水绕孤村。
销魂!当此际,香囊暗解,罗带轻分。
谩赢得青楼,薄幸名存。
此去何时见也?
襟袖上、空惹啼痕。
伤情处,高城望断,灯火已黄昏

贺铸
贺铸(1052-1125),字方回,号庆湖遗老。卫州共城(今河南辉县)人。宋太祖孝惠皇后族孙。授右班殿直。元祐中,通判泗州,又倅太平州,晚年居于吴下。工于词,有《庆湖遗老集》、《东山词》。

【青玉案】
凌波不过横塘路,但目送,芳尘去。
锦瑟年华谁与度?
月桥花院,琐窗朱户,只有春知处。
飞云冉冉蘅皋暮,彩笔新题断肠句。
若问闲情都几许?
一川烟草,满城风絮,梅子黄时雨。

 

李之仪(1038 -1117),字端叔,晚号姑溪居士、姑溪老农。沧州无棣(今属山东)人。熙宁三年(1070)进士。苏轼知定州时李之仪为幕僚,得苏轼赏识。后官至枢密院编修。徽宗朝,提举河东常平,坐罪编管太平州,遂居姑熟。终朝议大夫。有《姑溪居士文集》、《姑溪词》。
【卜算子】
我住长江头,君住长江尾。
日日思君不见君,共饮长江水。
此水几时休?此恨何时已?
只愿君心似我心,定不负相思意。

 

李清照(1084-约1151),号易安居士,济南(又说章丘,今属山东)人。李格非之女,赵明诚妻,与夫共事金石研究,夫卒后流寓越州、杭州,晚居金华。工词,风格婉约清丽,亦能诗文,著有《金石录后序》、《词论》等,其词集《易安词》不传,后人辑为《漱玉词》。
【醉花阴】
薄雾浓云愁永昼,瑞脑消金兽。
佳节又重阳,玉枕纱厨,半夜凉初透。
东篱把酒黄昏后,有暗香盈袖。
莫道不消魂,帘卷西风,人比黄花瘦。

 


苏东坡

苏轼的后半生,基本上是在党争的倾轧下到处遇贬,颠沛流离之中度过的,到晚年终于被赦北还,路过金山的时候,自题画像一偈,云:“心似已灰之木,身如不系之舟。问汝平生功业,黄州儋州惠州。”这三州都是他被贬最困苦的去处,然而就是在这困苦之中,磨练了他超人的意志力和愈挫折愈豁达的胸怀,人生的苦难,于他是一服清凉散。经历几番贬窜之后,他对“名”的追求,已不再是坚信“异时对,黄楼夜景,为余浩叹。”也不复坚持“西州路,不应回首,为我沾衣。”而是:“君看今古悠悠,浮幻人间世。这些百岁光阴几日?三万六千而已。醉乡路稳不妨行,但人生要适意耳。”(《哨遍》)

【狱中寄子由二首】
一作:予以事系御史台狱,狱吏稍见侵,自度不能堪,死狱中,不得一别子由,故和二诗授狱卒梁成,以遗子由。二首
圣主如天万物春,小臣愚暗自忘身。
百年未满先偿债,十口无归更累人。
是处青山可埋骨,他年夜雨独伤神。
与君世世为兄弟,更结人间未了因。

柏台霜气夜凄凄,风动琅珰月向低。
梦绕云山心似鹿,魂飞汤火命如鸡。
眼中犀角真吾子,身后牛衣愧老妻。
百岁神游定何处,桐乡知葬浙江西。

狱中闻湖杭民为余作解厄斋经月,所以有此句也。朱邑葬桐乡。犀角,杜琮事。

【卜算子】  黄州定慧院寓居作

缺月挂疏桐,漏断人初静。
谁见幽人独往来?缥缈孤鸿影。

惊起却回头,有恨无人省。
拣尽寒枝不肯栖,寂寞沙洲冷。

【蝶恋花 春景】:
花褪残红青杏小。
燕子飞时,绿水人家绕。
枝上柳绵吹又少,天涯何处无芳草?
墙里秋千墙外道。
墙外行人,墙里佳人笑。
笑渐不闻声渐消,多情却被无情恼。

Tuesday, March 18, 2008

JRuby on Rails on Tomcat

Rails 1.0

  • Modify config/environment.rb
require File.join(File.dirname(__FILE__), 'boot')

if RUBY_PLATFORM =~ /java/
require 'rubygems'
RAILS_CONNECTION_ADAPTERS = %w(jdbc)
end

Rails::Initializer.run do |config|



Rails 2.0



Steps



Install software stack



install jruby, rails



jruby -S gem install activerecord-jdbc-adapter



download oracle jdbc driver and put it in $JRUBY_HOME/lib.



jruby -S gem install warbler



then create a simple CRUD Rails 2.0 app:




  1. jruby -S rails bookstore


  2. cd bookstore


  3. modify config/database.yml

    development:

       adapter: jdbc


       driver: oracle.jdbc.driver.OracleDriver


       url: jdbc:oracle:thin:@phpdev.cn.oracle.com/dbtest


       username: rails


       password: rails





    production:


      development (note: needed when deployed)





  4. jruby script/generate scaffold book name:string description:text price:float


  5. jruby -S rake db:migrate


  6. jruby script/server


  7. Navigate to http://localhost:3000/books



Make WAR



jruby -S warble



$ jruby -S warble config



$ vi config/warble.rb :




#13: config.gems = ["activerecord-jdbc-adapter", "rails"]




$ jruby -S warble war



Deploy



copy ojdbc5.jar to $TOMCAT_HOME/shared/lib



copy app_name.war to $TOMCAT_HOME/webapps



start Tomcat



Navigate to http://localhost:8080/app_name



TroubleShooting



No :secret given to the #protect_from_forgery call.  Set that or use a session store capable of generating its own keys (Cookie Session Store).


uncomment the secret in line 9 in app\controllers\application.rb then restart Tomcat.



References





 

Deploy Rails app with JRuby to J2EE Server

Package Rails application as WAR file.

Goldspike

Java web applications are typically packaged as WAR files in preparation for distribution and deployment to Java EE servers. It is useful to be able to package Ruby on Rails applications in a similar form, to enable seamless deployment to Java servers. This is what Goldspike (a rails plugin) does.

GoldSpike has been tested on:

Warbler 

better than Goldspike

http://caldersphere.rubyforge.org/warbler/

http://wiki.jruby.org/wiki/Warbler

Warbler is a gem to make a .war file out of a Rails project. The intent is to provide a minimal, flexible, ruby-like way to bundle up all of your application files for deployment to a Java application server.

Warbler provides a sane set of out-of-the box defaults that should allow most Rails applications without external gem dependencies (aside from Rails itself) to assemble and Just Work.

Warbler bundles JRuby and the Goldspike servlet for dispatching requests to your application inside the java application server, and assembles all jar files in WARBLER_HOME/lib/*.jar into your application. No external dependencies are downloaded.

How to Use

get it:
$ jruby -S gem install warbler
And then, in the top directory of your Rails application:
$ warbler war
config it:
$ warbler config
$ vi config/warble.rb

Thursday, March 13, 2008

Java SE 6 新特性: 对脚本语言的支持

 

Java 脚本 API 概述

脚本引擎
脚本引擎就是指脚本的运行环境,它能能够把运行其上的解释性语言转换为更底层的汇编语言,没有脚本引擎,脚本就无法被运行。

Java SE 6 引入了对 Java Specification Request(JSR)223 的支持,JSR 223 旨在定义一个统一的规范,使得 Java 应用程序可以通过一套固定的接口与各种脚本引擎交互,从而达到在 Java 平台上调用各种脚本语言的目的。javax.script 包定义了这些接口,即 Java 脚本编程 API。Java 脚本 API 的目标与 Apache 项目 Bean Script Framework(BSF)类似,通过它 Java 应用程序就能通过虚拟机调用各种脚本,同时,脚本语言也能访问应用程序中的 Java 对象和方法。Java 脚本 API 是连通 Java 平台和脚本语言的桥梁。首先,通过它为数众多的现有 Java 库就能被各种脚本语言所利用,节省了开发成本缩短了开发周期;其次,可以把一些复杂异变的业务逻辑交给脚本语言处理,这又大大提高了开发效率。

Java SE 6 新特性: 对脚本语言的支持

Ruby Implementations - RubySpec

There are a number of Ruby implementations available today. The "standard" implementation is the original C-language-based implementation, written by Yukihiro Matsumoto (aka Matz), and now maintained by him and a number of contributors. JRuby is an implementation for the Java platform, currently led by Thomas Enebo and Charles Nutter. There are several other implementations and bridges at various states of completion.

Contents

[hide]

 

Original implementation

Ruby - The original C implementation and the "standard" to which others are compared

YARV - YARV is the most likely candidate for the Ruby 2.0 VM. It has been merged into the Ruby source tree since the 31 December 2006 and will be part of the official release of Ruby 2.0.

 

JVM Related (bridges and implementations)

Sun's JVM is the virtual machine which run bytecode, generated from Java as well as other languages. Python (with Jython) and JavaScript (with Rhino) were implemented earlier on it, it's only justice that finally Ruby was implemented too.

JRuby - Ruby for the Java Virtual Machine.

RJB - A Ruby to Java bridge.

YAJB - Yet Another Ruby to Java Bridge.

 

CLR Related (bridges and implementations)

Microsoft's Common Language Runtime (CLR) is the powerful set of classes accessible to all the .NET framework languages. With the Dynamic Language Runtime (DLR), the development of new dynamic language is facilitated therefore IronRuby was started by Microsoft using the DLR whereas Gardens Point Ruby.NET Compiler doesn't (being older than the DLR).

IronRuby - A Ruby implementation on the top of the CLR using the DLR.

Gardens Point Ruby.NET Compiler - A Ruby implementation on the top of the CLR built without using the DLR.

Ruby .NET - A Ruby to the CLR bridge.

 

Others

Cardinal - Ruby for the Parrot VM.

MetaRuby - Ruby-based implementation of Ruby, using ruby2c.

Rubinius - Implementation of a Ruby VM almost entirely in Ruby.

RubyCocoa - A Ruby/Objective-C Bridge for Mac OS X with Cocoa.

There is a little evidence for builds on Win CE, for example Wince.

Retrieved from "http://spec.ruby-doc.org/wiki/Ruby_Implementations"

Wednesday, March 12, 2008

JRuby

  • Wonderful Introduction to JRuby
  • JRuby - Wikipedia, the free encyclopedia
  • JRuby is a Java implementation of the Ruby interpreter, being developed by the JRuby team.

    JRuby is free software released under a three-way CPL/GPL/LGPL license.

    JRuby is tightly integrated with Java to allow the embedding of the interpreter into any Java application with full two-way access between the Java and the Ruby code. (Compare Jython for the Python language.)

    JRuby is Ruby on the JVM. It is a Ruby interpreter written entirely in Java. JRuby allows using Java capabilities with Ruby syntax. It also allows using Ruby libraries from Java.

    Many programming languages have been implemented on the JVM. The list includes BeanShell, Bex (BeanShell variant), Groovy, Jaskell (Haskell), Jawk (AWK), JudoScript, Jython (Python), JRuby (Ruby), Pnuts, Quercus (PHP), Rhino (JavaScript), SISC (Scheme), Sleep (Perl/Objective-C), Jacl (TCL) and more. A full list is available at http://scripting.dev.java.net/.

    JRuby supports all Ruby syntax and built-in libraries. It supports most of the Ruby standard libraries. Those implemented in Ruby were easy to retain. Those implemented in C had to be ported to Java. Only the most frequently used of those libraries have been ported so far. Many popular Ruby libraries work under JRuby today. These include Active Record (with JDBC), DRb, Rake (Ruby's answer to Make and Java's Ant), Rails, RSpec (behavior-driven development) and RubyGems.

    JRuby History

    Stephen Matthias Aust ported the Ruby grammar from the C-based Ruby interpreter to Jay, a Java-based parser which is still used by JRuby. Jan Arne Petersen started JRuby project in 2001, building on the work by Aust. Thomas Enebo began work on JRuby in late 2002 and became the project lead in late 2003. Charles Nutter began work on JRuby in 2004. Sun Microsystems hired Nutter and Enebo to develop JRuby full-time in September, 2006. This was at least partially motivated by Tim Bray at Sun who is a major advocate of dynamic languages. Sun is committed to keeping JRuby open source and will provide more Ruby development tools such as support in NetBeans. Ola Bini became a committer in October, 2006. Nick Sieger became a committer in January, 2007.

    What JRuby Offers That Ruby Doesn't

    JRuby classes can inherit from Java classes and implement Java interfaces. They can even add methods to existing Java classes. These methods are visible from JRuby, but not Java. We'll discuss this in more detail later. (Java classes can't inherit from a JRuby class.)

    Running on the JVM provides many benefits. As mentioned earlier, this allows Java libraries to be used from Ruby syntax. It also provides features Java enjoys such as use of native threads, Unicode support (surprisingly weak in Ruby), and portability to any platform with a JVM (which is most platforms).

    Installing JRuby

    To install JRuby, download a binary release from http://www.jruby.org. Unzip/untar the downloaded archive, set the JRUBY_HOME environment variable to point to resulting directory, and add $JRUBY_HOME/bin to the PATH environment variable.

    To checkout the latest version from the trunk of the Subversion respository, run the following command.

    svn co http://svn.codehaus.org/jruby/trunk/jruby


    To build this, ensure that Java and Ant are installed, and run "ant".



    Java Counterparts in JRuby



    To use java in ruby, first of all:

    include Java
      (require 'java' doesn't work after 1.0)



    Accessing External Classes: 
    require "/path/to/xxx.yyy.jar" and


    include_class Java::xxx.yyy.MyClass



    Implementing a Java Interface



    class SomeClass

      include RunCompare


      ...


    end



    Import a java package:



    import => include_class  :include_class java.lang.System

    Komodo开源啦

    Komodo开源啦 - 综合技术新闻 - 技术新闻 - JavaEye新闻:

    "Komodo是一个强大的脚本语言编辑器,支持PHP,Perl,Python和Ruby语言的代码高亮,语法提示,调试器,是一个相当强大的通用脚本语言开发工具。

    Komodo是一个商业软件产品,最近Komodo推出了免费开源的版本 - OpenKomodo,专门面向动态脚本语言开发,还支持HTML/JavaScript编辑器,下载地址是:

    http://www.openkomodo.com/

    作为Ruby或者Python开发着,Open Komodo是一个相当不错的轻量级脚本开发工具,不妨试试看。"

    Maven - Welcome to Maven

    Maven - Welcome to Maven: "Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information."

    Tuesday, March 11, 2008

    BlazeDS - BlazeDS - Confluence

    BlazeDS - BlazeDS - Confluence

     

    BlazeDS is a set of data services that significantly simplify the development of data-driven Rich Internet Applications, and dramatically improve the performance of their data access operations. In addition, BlazeDS enables the creation of a new breed of real-time data push and collaborative applications. BlazeDS is deployed as a set of JAR files as part of your Web application running in your Java EE application server or servlet container.

    BlazeDS consists of three key services:

    • The Remoting Service allows your Flex application to directly invoke methods of Java objects deployed in your application server.
    • The Message Service provides a publish/subscribe infrastructure that allows your Flex application to publish messages and subscribe to a messaging destination, enabling the development of real-time data push and collaborative applications.
    • The Proxy Service allows your Flex application to make cross-domain service requests in a secure and controlled manner. In other words, it allows your Flex application to access a service available on a different domain than the domain from where the application was downloaded (without having to deploy a crossdomain.xml policy file on the target domain).

    Monday, March 10, 2008

    Aptana Studio + Adobe AIR | Aptana

     

    Aptana Studio Features
    • Free and open source; cross-platform, stand-alone product or Eclipse plug-in
    • File and project-based workflow with integrated FTP/SFTP
    • Real-time, Wiki-based online help; Studio translated into multiple languages
    • Scriptable using JavaScript ("Aptana Monkey")
    • Backed by full-time developers; well over a million combined downloads
    • Deep support (including cross-browser tips) for JavaScript, HTML, CSS
    • Syntax highlighting, auto completion, code assist, error reporting, etc.
    • Full support for JavaScript and CSS embedded within HTML; unified outlining
    • Works with any JavaScript, incl. all Ajax libraries
    • JavaScript debugger with live Firebug integration
    Aptana Features for Adobe AIRTM
    • Adobe AIR Project contains all necessary files for out-of-the box launching of Adobe AIR applications
    • Export wizard for bundling and deploying Adobe AIR applications
    • Support for running parts of your Adobe AIR application on the server using Jaxer
    • Easy import of Ajax libraries into Adobe AIR projects
    • Integrated content assist for the Adobe AIR SDK
    • Includes the Adobe AIR runtime and SDK
    • Certificate creation and management for signing Adobe AIR applications
    • Help and online documentation
    • Adobe AIR samples that can be previewed or imported as project
    Adobe® AIRTM Features
    • Create desktop applications using HTML/JS/CSS
    • Support creation of transparent HTML windows. Developer can now create semi-transparent non-rectangular shaped HTML/JS based applications
    • Local file system access. Applications can access and leverage local file system via File I/O API once installed
    • Network detection API's
    • Server monitoring framework-allows detection for server availability to support offline and occasionally connected applications
    • Support cross platform icons
    • Application update API's
    • Multiple-window support
    • Drag-and-drop and copy-and-paste
    • Supports running popular Ajax frameworks

    Aptana Studio + Adobe AIR | Aptana

    jersey: RESTful Web services made easy in Java

     

    Jersey is the open source (under the CDDL license) JAX-RS (JSR 311) Reference Implementation for building RESTful Web services. But, it is also more than the Reference Implementation. Jersey provides additional APIs and extension points (SPIs) so that developers may extend Jersey to suite their needs.
    The governance policy is the same as the GlassFish project.

    jersey: RESTful Web services made easy in Java

    Representational State Transfer - Wikipedia, the free encyclopedia

    Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The terms “Representational State Transfer” and “REST” were introduced in 2000 in the doctoral dissertation of Roy Fielding,[1] one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification

    REST’s proponents argue that the Web enjoyed the scalability and growth that it has had as a direct result of a few key design principles:

    • Application state and functionality are divided into resources
    • Every resource is uniquely addressable using a universal syntax for use in hypermedia links
    • All resources share a uniform interface for the transfer of state between client and resource, consisting of
    • A protocol that is:

    Representational State Transfer - Wikipedia, the free encyclopedia

    用Rails创建REST服务 - IBM dW

     跨越边界: REST on Rails

    Google Answers: Using LGPL code for commercial application

    Google Answers: Using LGPL code for commercial application

    Friday, March 7, 2008

    HTML 组件 - HTC 概述

    初探 HTML 组件 - HTC 概述 - 资源管理 - 爱国者黑客

    HTC 概述

    从 Internet Explorer 5 开始引入了 HTML 组件的概念, HTML 组件也是 Internet Explore 5.5 一个革命性的突破。Microsoft 的目的是用它取代 ActiveX 控件。HTML 组件是封装的对象,也像 ActiveX 控件一样是“自包含”的,可以在开发完后发布给任何人。HTC 文件并不仅仅是将一个 HTML 文件的扩展名换成 .htc,它含有脚本和 HTC 定制元素的集合。

    在 HTML 文件中,HTC 拥有和页面中其他的 DHTML 元素一样的访问方式。这就意味着所有 HTC 元素都可以通过 id 属性在脚本中调用,也就是说 HTC 元素的属性、方法都可以通过脚本来进行灵活的运用。

    您可以通过下面几种方式来执行 DHTML 行为:


    • 定义属性和方法。在 HTC 中分别使用 PUBLIC:PROPERTY 和 PUBLIC:METHOD 元素来定义 HTC 的属性和方法。
    • 定义事件:通过 EVENT 元素定义,使用元素的 fire () 方法在它们所在的页面里 引发这些事件。事件的环境可以通过 createEventObject () 方法设置。
    • 在它们所在的页面里访问 DHTML 对象模型。HTC 中的 object 元素返回它所附属的元素, 通过这个对象,HTC 能访问他所在的文档及其对象模型 (属性、方法和事件)。
    • 接受通报。当使用 ATTACH 元素时,浏览器向 HTC 通报标准 DHTML 事件和两个 HTC 专有 事件,oncontentready 和 ondocumentready。

    Wednesday, March 5, 2008

    并行编程语言Erlang学习专题

    Erlang是一个并行编程语言和运行时系统,最初由爱立信(Ericsson)于1987年为电信行业所开发。1998年爱立信在改良的MPL(Mozilla Public License)许可下将Erlang发布于开源社区。Erlang作为一种函数编程语言,它优秀的并发性和容错性能可与其他主流语言相比,某些功能是Python、Ruby等语言所不及,这些年来逐渐受到重视。它的IDE1.0版本也即将发布,作为一种面向小众的语言,你对它了解多少?是否认为它会成为一种主流语言呢?

    Erlang概述
    Erlang不但是一种编程语言,而且它具有比编程语言更加贴近操作系统的一些特性:并发线程、作业调度、内存管理、分布式、网络化等。据说使用Erlang编写的Yaws Web服务器,其并发性能是apache的15倍!
    这个Erlang初始开源版本包含了Erlang的实现,同时它也是用于构建分布式高可用性系统的Ericsson中间件的最大组成部分。
    Erlang具有以下特性:
    并发性 - Erlang具有超强的轻量级进程,这种进程对内存的需求是动态变化的,并且它没有共享内存和通过异步消息传送的通讯。Erlang支持超大量级的并发线程,并且不需要操作系统具有并发机制。
    分布式 - Erlang被设计用于运行在分布式环境下。一个Erlang虚拟机被成为Erlang节点。一个分布式Erlang系统是多个Erlang节点组成的网络(通常每个处理器被作为一个节点)。一个Erlang节点能够创建运行在其它节点上的并行线程,而其它节点可以使用其它操作系统。线程依赖不同节点之间的通讯,这完全和它依赖于单一节点一样。
    健壮性 - Erlang具有多种基本的错误检测能力,它们能够用于构建容错系统。例如,进程能够监控其它进程的状态和活动,甚至这些进程是在其它节点上执行。在分布式系统中的线程能够配置为在其它节点故障的情况下自动进行故障恢复,并在故障节点恢复时自动迁移回到恢复节点。
    软实时性 - Erlang支持可编程的“软”实时系统,这种系统需要反应时间在毫秒级。而在这种系统中,长时间的垃圾收集(garbage collection)延迟是无法接受的,因此Erlang使用了递增式垃圾收集技术。
    热代码升级 - 一些系统不能够由于软件维护而停止运行。Erlang允许程序代码在运行系统中被修改。旧代码能被逐步淘汰而后被新代码替换。在此过渡期间,新旧代码是共存的。这也使得安装bug补丁、在运行系统上升级而不干扰系统操作成为了可能。
    递增式代码装载 - 用户能够控制代码如何被装载的细节。在嵌入式系统中,所有代码通常是在启动时就被完全装载。而在开发系统中,代码是按需装载的,甚至在系统运行时被装载的。如果测试到了未覆盖的bug,那么只有具有bug的代码需要被替换。
    外部接口 - Erlang进程与外部世界之间的通讯使用和在Erlang进程之间相同的消息传送机制。这种机制被用于和操作系统通讯、与其它语言编写的程序交互。如果出于高效率的需要,这种机制的一个特殊版本也允许例如C程序这样的代码直接链接到Erlang运行时系统中来。
    Erlang组件
    Erlang具有许多单独的组件,它们能够在开发应用时作为组建块(building blocks)使用。同时这些组件也熟知Erlang的系统消息(load、unload、start、stop、restart、change code)。
    Inets - HTTP 1.0服务器和FTP客户端。
    Mnesia - 使用Erlang的分布式实时数据库。它支持RAM复制、磁盘存储、动态改变shema、保存任意复杂的数据结构。Mnesia之所以非常快速,是因为它运行在和应用相同的地址空间(因为Mnesia和应用都使用Erlang编写)。Mnesia展示了Erlang的强大:你能够使用多少种语言使用少于20000行的代码编写一个全特性、工业强度、分布式的DBMS?
    Orber - CORBA v2.0对象请求代理(ORB)。
    SNMP – 可扩展的SNMP v1/v2代理和MIB编译器。
    Erlang工具和代码库
    Erlang具有一套常用工具库:
    Appmon - 进程组图形监控(在本地和远程节点上)。
    ASN.1 - 支持ASN.1基本标记法和BER、DER、PER编码规则的编译时和运行时的代码包。
    Compiler - Erlang编译器。
    Debugger - 图形化Erlang调试器。
    ERTS - Erlang运行时系统,包括虚拟机、垃圾收集、端口映射守护进程。
    GS - 编写图形用户接口的代码库。
    IC - 把OMG的接口定义语言(IDL)转换到Erlang、C和Java语言的编译器。
    Kernel - 运行Erlang系统所必须的C代码:Erlang内建功能(BIFs);代码、启动、命名服务;对网络和分布式的支持;装载器、连接器、记录器;操作系统和文件系统接口。
    Mnemosyne - 可选的用于Mnesia的查询语言。
    Mnesia Session - 以IDL定义的与Mnesia接口的外部语言,它们通过IIOP和erl_interface协议对Mnesia进行访问。
    OS monitor (OS_MON) - 监控CPU、硬盘、内存使用情况,包括SNMPv1/v2 MIBs。并且提供了与Solaris syslogd、Windows NT事件日志的接口。
    Parse tools - 用于Erlang的LALR-1解析生成器(yecc),它和yacc类似。Yecc使用BMF语法定义作为输入,生成Erlang代码作为解析输出。Yecc被用于生成Erlang解析器。
    PMan - 跟踪、查看Erlang进程状态(在本地或者远程节点上)的工具。
    SASL - 进程、错误、崩溃报告处理、报告浏览、释放处理、重载管理。
    Stdlib - 标准代码库:输入、输出;基于内存、磁盘的表存储(ETS和DETS);图表、字典、列表、字符串、集合、队列;正则表达式;数学公式。Erlang解释器、tokenizer、解析器、lint和格式化打印。用于容错服务器的通用框架、事件处理器、状态机和线程监管等等。
    Table visualizer - 查看ETS和Mnesia表格的工具。
    Toolbar - 简化了对Erlang工具的访问。
    Tools - 覆盖分析器、优化器、基于文字的跟踪器、Emacs模式、Emacs TAGS文件生成器、make工具、调用图形化工具。

    Monday, March 3, 2008

    THE EYE OF RIA - RIA News And Technology

    THE EYE OF RIA » Ajax

    Localizing JSF and ADF Faces applications

    This article explains how to internationalize an ADF Faces and JSF application. The article will also make some comparisons with JSF core components and ADF Faces equivalent components regards to what level of support for locales are provided. Oracle JDeveloper 10g (10.1.3) Preview will be used to illustrate and build the actual application. This article is divided into two parts - one that is explaining the core setup to enable locale support with JSF core components, and the second part is covering the same scenario using Oracle ADF Faces components and comparing the two component sets. For more information and articles, please, refer to the JDeveloper page, ADF Faces page, and JSF Resource page on Oracle Technology Network (OTN).

    Prerequisites
    Making a JSF application localized

    Internationalize your application
    Configure your application to support multiple languages
    Localize an application built with ADF Faces

    Localize the page
    Adding ADF Faces components to the page
    More information

    Localizing JSF and ADF Faces applications

     
    free hit counter
    hit counter