Tuesday, July 26, 2011

Sehcha Touch - Examples

http://dev.sencha.com/deploy/touch/examples/

Friday, July 22, 2011

C++ - MD and MT compile option


Simple explanation



Microsoft Visual C++ Static and Dynamic Libraries





http://shitohichiumaya.blogspot.com/2009/10/visual-c-md-and-mt-compile-option.html

- MT: Multi-threaded static library. This is good for distribution a whole application package, since everything is statically linked and there is no dependency to the environment.

- MD: Multi-threaded Dynamic link library. If you distribute some library instead of a whole application, dynamically linked runtime is better since, some part of the program uses one version of runtime, and the other uses different version,this causes a trouble. For example, 'new'ed some memory at one version of runtime, and 'delete'd by other version of runtime could be a trouble.




http://dev.mobixo.net/2008/03/use-mtd-or-mdd.html



/MD
causes application to use the multithread- and DLL-specific version of the run-time library. Applications compiled with this option are linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR80.DLL, which must be available at run time to applications linked with MSVCRT.lib.

/MT

causes your application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.

C++ - The #include Directive

http://msdn.microsoft.com/en-us/library/36k2cdd4(v=vs.80).aspx



#include  "path-spec"
#include  <path-spec>

Syntax FormAction
Quoted form
This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.
Angle-bracket form
This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.

web terminologies

AJAX - http://en.wikipedia.org/wiki/Ajax_(programming)
Document Object Model (DOM)
The Document Object Model (DOM) is a cross-platform andlanguage-independent convention for representing and interacting with objects in HTMLXHTML and XML documents.
http://www.quirksmode.org/dom/intro.html

Difference Between Unicode and ASCII,

http://www.differencebetween.com/difference-between-unicode-and-ascii/

Thursday, July 21, 2011

Sencha - loading an image

- set an ID of Panel (e.g., PreviewPaneAI)
- set an ID of a sub-panel for an image (e.g., assetImageContainerAI),
and set a height properly.
- Send an image properly to a client from Phython,

- Use the following code for AIuserProject.js.
updatePreview: function(node) {
        var str='<img src="{img}" style="float: right;" height="100%" />';
        str = str.replace("{img}",node.attributes.thumbnailURL);
        panel = Ext.getCmp('assetImageContainerAI');
        panel.body.update(str);
}

Tuesday, July 19, 2011

Sencha - combo box

After creating a combo box, we have to




 





- Set the url. 
- Set id and autoRef.
- minChars: 0,
- displayField: 'filename',  (which is one of components of the fileStore.)


For 'load project preset',
we need to set autoRef: fileLoadForm2 of the FormPanel, 
and autoRef: loadProjectPresetButton2 of the Button, 
and then implement as follows (MainPanel.js)
this.loadProjectPresetButton2.on('click', this.onSubmitClick.createCallback(this, this.fileLoadForm2, false));
this.loadProjectPresetButton2.on('click', this.delayRefreshAllTrees, this );

In addition, Tree.py 
if "fileSelectCombobox2" in e.__dict__:
self.loadTree(os.path.join(BASE_PROJECT_FOLDERS[0],e.fileSelectCombobox2)+PROJECTFILE_INDICATOR)



// Upload from Vizard to Browser of saved trees.//
socket.onevent('saved_trees', function(e){
//})



# Strip ?_dc request
#page_request = page_request.split('?_dc')[0]

Sencha - textfield



First, make a Textfield and a Button under a FormPanel including a FieldSet (which is for a layout).
FormPanel should have an autoRef (e.g., fileSaveForm) for this code (MainPanel.js)

The 'fileSaveButton' is an autoRef of the 'Save Project Preset' button.
'fileSaveField' is an autoRef of the textfield.


this.fileSaveButton.on('click', this.onSubmitClick.createCallback(this, this.fileSaveForm, false));
this.fileSaveButton.on('click', this.delayRefreshAllTrees, this);

Finally, when a user clicks the button, the fileSaveForm is invoked
and somehow the textfield under the formpanel is invoked as well.
Then, a text message (written by the user) is transferred to python scripts using a callback function.
mk:@MSITStore:C:\Program%20Files%20(x86)\WorldViz\Vizard4\help\Vizard.chm::/vizhtml_collecting_form_data.htm




On the other hand, when you display something from python to Sencha,  we can call data as follows. 
Of course, somehow we need to register JSON.
vizhtml.registerCode("check-nodes.json",items,isFile=True)

    initComponent: function() {
            this.on('click', this.onClick, this);
    },
    onClick: function(node){
        if (node.isLeaf()) {
            this.updatePreview(node);
        }
    },
    updatePreview: function(node) {
        Ext.getCmp('fileSaveField').setValue(node.attributes.file_location);
    }

Monday, July 18, 2011

Python - Get IP address of server

# Get IP address of server
LOCAL_SERVER_IP = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][-1]
if not LOCAL_SERVER_IP:
    LOCAL_SERVER_IP = 'localhost'
treeutils.LOCAL_SERVER_IP = LOCAL_SERVER_IP # Tell treeutils the server address


http://www.velocityreviews.com/forums/t339971-get-the-ip-address-of-a-host.html

Wednesday, July 6, 2011

Javascript - Sencha Tree

Learning EXT Designer (Sencha)
http://www.alib.spb.ru/download/web/learning_extjs.pdf

Examples.
http://dev.sencha.com/deploy/ext-4.0.0/examples/ 

Getting Ext.Elements

http://docs.sencha.com/core/manual/content/element.html


Simple tutorial about EXT Designer.
http://aboutfrontend.com/extjs/ext-designer-tutorial-for-a-developer/

Tutorial
http://www.sencha.com/learn/Tutorials

Intro and APIs
http://docs.sencha.com/ext-js/4-0/



http://docs.sencha.com/ext-js/4-0/#/guide/tree



http://newsite.sencha.com/learn/Tutorial:Extending_Ext_for_Newbies


xtype
http://www.sencha.com/learn/Tutorial:Xtype_defined

Tree

To display hierarchical data in a collapsible list, you use a TreePanel container. A TreePanel contains a
root node and any number of child nodes. You can build a static tree, or use a TreeLoader to load data
into the tree asynchronously.
http://www.sencha.com/forum/showthread.php?98442-TreePanel-with-tri-state-checkboxes


Availability via ComponentMgr
Every component in Ext gets registered with the ComponentMgr on creation, so you can retrieve any component at any time simply by calling Ext.getCmp('id').



http://www.sencha.com/forum/showthread.php?123644-CodeMirror-and-Sencha-%28ExtJs%29


How to uncheck all tree node in Ext.tree.TreePanel

http://stackoverflow.com/questions/4450360/how-to-uncheck-all-tree-node-in-ext-tree-treepanel

FireBug
http://getfirebug.com/

Global var for js
http://stackoverflow.com/questions/944273/how-to-declare-a-global-variable-in-a-js-file


Misc
http://www.sencha.com/forum/showthread.php?12888-solved-programatically-unchecking-checked-tree-nodes&p=62845#post62845
http://docs.sencha.com/ext-js/4-0/#/api/Ext.form.field.Checkbox-cfg-uncheckedValue
http://docs.sencha.com/ext-js/4-0/#/api/Ext.tree.Panel-event-checkchange




multiple tree root nodes

http://www.sencha.com/forum/showthread.php?39142-multiple-tree-root-nodes



EXT JS

-

Javascript
JavaScript is an object-based language. Every data item is an object. Numbers, strings, dates, and Booleans (true or false values) are all objects. JavaScript variables reference the objects we assign to them. In JavaScript, functions are also objects, and may be assigned to variables and passed as parameters just the same as other objects. A function declaration is a literal in just the same way that a quoted string is a literal.

var myVariable = "A string literal";
alert(myVariable);
myVariable = function() {
         alert("Executing the function");
};
myVariable();

This concept is central to your understanding of much of what follows. Functions will be passed as parameters into Ext JS methods to be called by Ext JS to handle user interface events or network communication (AJAX) events.

It is important to remember that when a function reference is passed, it's only a pointer to a function object. If that function was a member method of an object, then this information is not included. If the function is to be executed as a member method of an object, then that information must be included when passing the function. This is the concept of scope, which will be very important in later chapters.

Three Main Files..
- ext-all.css: A stylesheet file that controls the look and feel of Ext JS
widgets. This file must always be included as-is, with no modifications. Any
changes to the CSS in this file would break future upgrades. If we decide that
the look and feel of Ext JS needs to be adjusted, another stylesheet containing
the overrides should be included after the ext-all.css file.
ext-base.js: This file provides the core functionality of Ext JS. It's the
foundation upon which Ext JS builds its capabilities, and provides the
interface to the browser environment. This is the file that we would change
if we wanted to use another library, such as jQuery, along with Ext JS.
ext-all-debug.js/ext-all.js: All of the widgets live in this file. The
debug version should always be used during development, and then
swapped out for the non-debug version for production.

The Ext.onReady function accepts a function as its first parameter. It will call that
function when the page has fully loaded, and the HTML document is ready to be
manipulated. If you pass a function to Ext.onReady when the document is already
fully initialized, it will be called immediately.


Widgets and classes
Ext JS has many "widgets". These are implemented as classes. These include components such as a message box, grid, window, tree, form, and pretty much everything else that serves a particular user interface function. These will mostly be referred to as 'Components'. There are also data, utility, and
other base classes to aid with development. Methods like onReady are part of the core functions. We only refer to classes that provide a specific user interface role as "widgets"—like the grid that is used to present tabular data to the user.

Ext.get

Ext JS is able to work so well, because it has a foundation that provides access to the DOM, and to many functions that allow manipulation of the DOM. These are part of the Ext Core library. Of these functions, get is one of the most used.
         Var myDiv = Ext.get('my_id');
This gives us access to an element in the document with the ID, my_id by wrapping it in an Ext.Element object which provides cross-browser methods to work with DOM elements.


xtype:
Defines which type of Ext JS component will be used: text, date, number, or any of the many others. This could even be a grid or some other type of Ext JS component.
Be aware that the default xtype is a panel. Any {…} structure with no xtype property, as an element in an items config, results in a panel at that position.

{
        xtype: 'textfield',
        fieldLabel: 'Title',
        name: 'title'
}

name
The name config is just the same as its HTML counterpart and will be used as the parameter name when sending form data to the server.
 The names of most of the config options for Ext components match their counterparts in HTML. This is because Ext was created by web developers, for web developers.

Validation
There are many more configuration options, specific to each specialized Ext JS Component class. To easily find what options are available in the online documentation, use the Hide inherited members button at the top right. This will hide config options from the base classes of the Component's heritage, and only show you options from the Component you are interested in: