Wednesday, April 16, 2008

Manual:Intro:Class Design cn - Learn About the Ext JavaScript Library

Manual:Intro:Class Design cn - Learn About the Ext JavaScript Library: "你必须使用prototype对象:

// 我们定义了一个prototype对象的一个方法
myClass.prototype.sharedMethod = function() { alert('I'm a shared method') }

// 显示我们的信息
A.sharedMethod();

// 相同的信息
B.sharedMethod();

There is no method named sharedMethod in the myClass definition. Javascript looks for a method with this name in the prototype object of myClass and calls it if it exists. 在myClass定义中并没有一个名为sharedMethod的方法。Javascript会在myClass相关联的prototype对象中寻找与该方法名相同的方法,如果存在的话,Javascript则调用该方法。"

Manual:Intro:Class Design - Learn About the Ext JavaScript Library

Manual:Intro:Class Design - Learn About the Ext JavaScript Library: "// We define a method of the prototype object Ext.apply(myClass.prototype, { defaultClassName: 'x-widget-class', sharedMethod: function() { alert('I'm a shared method') } }); // Display our message A.sharedMethod(); // Same message B.sharedMethod();"

Monday, April 7, 2008

Ext JS Blog - » IDEs, plugins and tools for Ext JS 2.0

* Download and install Aptana Studio (includes Eclipse).
* Start Aptana and navigate the application menu to: Help → Software Updates → Find and Install… → Search for new features to install → New remote site…
* Name: “Spket”, Url: “http://www.spket.com/update/”
* Restart Aptana
* Watch this Spket IDE Tutorial to see how to easily add Ext code assist (you can point it at the latest /src/ext.jsb to keep code assist up to date with the latest Ext version). The steps are basically:
o Window → Preferences → Spket → JavaScript Profiles → New
o Enter “ExtJS” and click OK
o Select “ExtJS” and click “Add Library”, then choose “ExtJS” from the dropdown
o Select “ExtJS” and click “Add File”, then choose the “ext.jsb” file in your “./ext-2.x/source” directory
o Set the new ExtJS profile as the default by selecting it an clicking the “Default” button on the right-hand side of the “JavaScript Profiles” dialog.
o Restart Aptana
o Create a new JS file and type: Ext. and you should get the Ext Code completion options.

Sunday, April 6, 2008

Ext JS - JavaScript Library

Ext JS - JavaScript Library: "Finally it is possible to create sweet user- experiences for the web (cross-browser!!) without spending 2 months hating and fighting in javascript. This library has made me believe in web2.0 again.
— Steinar M."

Thursday, March 27, 2008

Tech Talk about C++ Templates / Comeau C++ Template FAQ

Tech Talk about C++ Templates / Comeau C++ Template FAQ: "What's the export keyword about?
Why do I get a link error when compiling my templates?
Although Standard C++ has no such requirement, some compilers require that all function templates need to be made available in every translation unit that it is used in. In effect, for those compilers, the bodies of template functions must be made available in a header file. To repeat: that means those compilers won't allow them to be defined in non-header files such as .cpp files. To clarify, in C++ese this means that this:

// ORIGINAL version of xyz.h
template
struct xyz
{
xyz();
~xyz();
};

would NOT be satisfied with these definitions of the ctor and dtors:

// ORIGINAL version of xyz.cpp
#include 'xyz.h'

template
xyz::xyz() {}

template
xyz::~xyz() {}

because using it:

// main.cpp
#include 'xyz.h'

int main()
{
xyz xyzint;

return 0;
}

will produce an error. For instance, with Comeau C++ you'd get:

C:\export>como xyz.cpp main.cpp
C++'ing xyz.cpp...
Comeau C/C++ 4.3.4.1 (May 29 2004 23:08:11) for MS_WINDOWS_x86
Copyright 1988-2004 Comeau Computing. All rights reserved.
MODE:non-stric"