Total Pageviews

2006/09/27

[JavaScript] How to do trim() in JavaScript

<body onload="test()">

<script>

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function test() {

var str = " a ";

alert("Original string: '" + str + "'");

str = str.trim();

alert("Incompletely stripped string: '" + str + "'");

}

</script>



reference
http://www.bigbold.com/snippets/posts/show/701

[JavaScript] How to do trim() in JavaScript

<body onload="test()">

<script>

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function test() {

var str = " a ";

alert("Original string: '" + str + "'");

str = str.trim();

alert("Incompletely stripped string: '" + str + "'");

}

</script>

2006/09/08

[Windchill] How to generate mData

Steps.
1. open rose
2. Tools --> Windchill --> System Generation
3. Click OK

Troubleshoot
It may show generation refuse error in the progress of system generation
Error: wt.templateutil.processor.DefaultTemplateProcessor is not Extendable, so cannot extend it.

Solution
1. Open user.properties (under /Codebase)
2. add one attribute wihch named
wt.generation.overrideNonExtendableClasses, and add classes which we want to do extend. If we have multiple classes need to do extend, sperate them by comma.

ex. wt.generation.overrideNonExtendableClasses=wt.templateutil.processor.DefaultTemplateProcessor,wt.templateutil.processor.FormTaskDelegate
After you add them to user.properties, you can see this kind of warning message, it means you had successfully finished system generation.
Warning: wt.templateutil.processor.DefaultTemplateProcessor is not Extendable, but is being allowed as a backward compatible override