Thursday, July 28, 2011

after using dojo.mixin(), need to do some post op to get rid of all 'undefined' values that passed into constructor

 after using dojo.mixin(this, p_args); have to make sure that neither of the defined as member variable is 'undefined' and note that 'undefined' can be pass into the constructor (which is different from where the parameter is not given at all) will override that '' default value.

other wise will get something like

"error: Error: *.widget.SummaryRow
template: library"

so need to do some post op to get rid of all 'undefined' values.
------------------------------------------------------------

dojo.provide("*.widget.SummaryRow");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");

dojo.declare("*.widget.SummaryRow", [ dijit._Widget,
        dijit._Templated ], {

    // Path to the template
    templateString : dojo.cache("*.widget",
            "templates/SummaryRow.html"),

    widgetsInTemplate : false,
   
    checkboxtitle : null,
    image : '',
    title : '',
    author : '',
    workflowstatus : '',
    description : '',
    contextpath : '',
    library : '',
    links : '',

    constructor : function(p_args) {
        dojo.mixin(this, p_args);
    },


    postMixInProperties : function() {
          alert("in postMixInProperties");
        this.library = this.getLibraryUuid(this.links);                     
    },

    getLibraryUuid : function(p_links) {
        alert("in getLibraryUuid(): p_links: " + p_links);
        return "WebContent";
    },

    postCreate : function() {
       
      this.inherited(arguments);
    }
});

Monday, July 25, 2011

Handle Parameters Override for RESTful service

1. Allow the user of the RESTful Service to be able to specify parameter that overrides attributes in the header is good practice since it is not always convenient for the user writing the client application to specify the attributes in the request header

2. For example, dojox.rpc.REST(<url>, <isJson>), a nice functionality, but you can't really explicitly specify what the 'Content-type' is except for whether it is application/json or not. But if the corresponding RESTful service handles parameter override, then the user can conveniently just put that into the <url>.

3. Arguably this deviate from the how REST should be different RPC, but practically, who cares?

opacity, z-index,

in Style

opacity: transparency, 0 is lowest, 1 is highest - in FF; IE is 0-100

z-index: layering, the higher the more on top the layer.

VBA: extract number from strings

http://www.ozgrid.com/VBA/ExtractNum.htm

Sunday, July 17, 2011

To pass string value as argument to a javascript function in HTML

To pass string value as argument to a javascript function in HTML

<li role="menuitem" id="createListItem">
                            <a tabindex="-1" href='javascript:onLeftMenuSelect("createListItem")'
                                id='createListItemLink'>Creates</a>
                        </li>

Thursday, July 14, 2011

Automated Testing: deletion before creation v.s. finally block (teardown, etc)

Deletion (if exist) before creation is the in general more recommended:

1.  Assuming that the Deletion logic is valid, the test cases should be guaranteed to rerun properly, even in case such as the Test run thread is forced to stop (JUnit stop button in Eclipse, anyone has not ever pressed?)


2. In some case, it is good to leave the data created/updated in the data store to assist test failure investigation.

Wednesday, July 13, 2011

using EARExpander

 http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rxml_earexpander.html

e.g.

/opt/WebSphere/AppServer/bin/EARExpander.sh -ear /opt/sampleUI.ear -operationDir /opt/WebSphere/wp_profile/installedApps/eli80/PA_wcm.portlet.design.ear/ -operation collapse

Writer, OutputStream, InputStream

http://ostermiller.org/convert_java_outputstream_inputstream.html

Sunday, July 10, 2011

clear case commandline force cancel delivery

windows --> run --> cmd

V:\

cleartool startview jjwang_WCM_REST_80_int
cd  jjwang_WCM_REST_80_int
cleartool deliver -status
cleartool deliver -cancel

Thursday, July 7, 2011

Set environmental variable in Ubuntu

https://help.ubuntu.com/community/EnvironmentVariables

Persistent environment variables

So far we've only discussed ways set an environment variable value temporarily until the shell session in which it was set is closed. One may wonder if there is a way to somehow permanently set an environment variable to a certain value.
Note: The shell config files mentioned below are only meant to be read by particular shells and desktop environments and should not be used.

Session-wide environment variables

The below are not recommended but the previous solution (?) provided on this page did not work with the 10.04 desktop release. .pam_environment is not naturally procesed with the distribution.
Not recommended:
  • ~/.profile - This is probably the best file for placing environment variable assignments in, since it gets executed automatically by the DisplayManager during the startup process desktop session as well as by the login shell when one logs-in from the textual console.
  • ~/.bash_profile or ~./bash_login - If one of these file exist, bash executes it rather then "~/.profile" when it is started as a login shell. (Bash will prefer "~/.bash_profile" to "~/.bash_login"). However, these files won't influence a graphical session by default.
  • ~/.bashrc - Because of the way Ubuntu currently sets up the various script files by default, this may be the easiest place to set variables in. The default configuration nearly guarantees that this file will be executed in each and every invocation of bash as well as while logging in to the graphical environment. However, performance-wise this may not be the best thing to do since it will cause values to be unnecessarily set many times.

System-wide environment variables

Environment variable settings that affect the system as a whole (rather then just a particular user) should not be placed in any of the many system-level scripts that get executed when the system or the desktop session are loaded, but into
  • /etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.
Not recommended:
  • /etc/profile - This file gets executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the DisplayManager when the desktop session loads. This is probably the file you will get referred to when asking veteran UNIX system administrators about environment variables. In Ubuntu, however, this file does little more then invoke the /etc/bash.bashrc file.
  • /etc/bash.bashrc - This is the system-wide version of the ~/.bashrc file. Ubuntu is configured by default to execute this file whenever a user enters a shell or the desktop environment.
Note: When dealing with end-user/home desktop systems may be appropriate to place settings in the user's ~/.pam_environment files discussed above rather then the system-wide ones, since those files do not require one to utilize root privileges in order to edit and are easily moved between systems.

Monday, July 4, 2011

JavaScript: method undefined - add 'this.'

read about the scoping of javascript

javascript: 'has no method ...' - check the spelling

Object wcmrest:05966917-7cf0-4324-ac1a-31cac57cd817 has no method 'indexof'

in fact it should be 
indexOf, 
simple as that. 
JavaScript is 'type-less' after all.

Friday, July 1, 2011

Be careful with form 'onSubmit' method, may cause thread 'race' situation

<form onSubmit="send();return false;">
...
<button onclick='send()'>submit</button>
</form>


where the 'send()' method is a ajax call to certain service, this will result two thread trying to use the service at almost exact same time, hence the the 'race'

use x11vnc to connect to the 'real' display

using

vncserver :#
vncserver -kill :#

will only start sessions that is not the 'same' desktop

If you would like to remote into a machine with vnc and actually see and interact with the root desktop you can use x11vnc,

just
x11vnc