Total Pageviews

2007/11/28

Windchill Quick Backup

Procedure

1. backup applicationa & configuration, i.e. D:\PTC\Windchill8\codebase

2. backup database, i.e. execute command: exp pdm8/pdm8@WINDDEV file=D:\tmp\database\WINDDEV.dmp log=D:\tmp\database\WINDDEV.log

If any problem occurred, just overwrite codebase and do database import to do system recovery

2007/11/26

Windchill Change Password

In past, Windchill does not provide change password function.
Many customers will complain about this.
Now, Windchill 8 M040 had provided.
But default, M040 disabled change password function, we need to turn it on.

Process:
1. define in site.xconf

1
2
3
<property name="wt.org.services.userPasswordChangeEnabled" 
          overridable="true" 
          targetfile="codebase/wt.properties" value="true">

2. execute xconfmanager -p in windchill shell

3. restart tomcat, method server. And do not forgot to clean tomcat cache.

2007/11/23

OraDoclet - Database Documentation Generator

Overview

The purpose of OraDoclet is generation of the detailed database documentation
resembling the JavaDoc style. It is a custom doclet that functions either with the
JavaDoc tool or as a standalone Java application. The documentation generated
has a form of static html files and describes all objects in the given Oracle
database schema.

http://oradoclet.sourceforge.net/

OraDoclet - Database Documentation Generator

2007/11/20

Java 2 Software Development Kit (J2SE SDK) - the new jre isn't working

Scenario
I have instaled the new j2se development kit 5.0 and jre5.0, but my browser cannot open any applet and Sun Java console. The error is ---- " The Java Runtime Environment cannot be loaded from <\bin\server\jvm.dll> ???!!!

Solution
In your "Documents and Settings\username\Application Data" folder you'll probably find a folder named "Sun". Delete that folder (or rename it).

reference: http://forum.java.sun.com/thread.jspa?threadID=567821&forumID=17

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

2006/08/27

[Mail] commons-mail 亂碼問題

[常見問題1]sent出去的mail的中文標題變成亂碼

呼叫setCharset此方法,設定編碼方式為UTF-8
public void setCharset(java.lang.String newCharset)
http://jakarta.apache.org/commons/email/api-release/org/apache/commons/mail/Email.html#setCharset(java.lang.String)



[常見問題2]sent出去的mail的中文內文便成亂碼

呼叫setContent此方法,第一個參數給予訊息內容,第二個參數給予conent type,例如text/plain;charset=UTF-8
public void setContent(java.lang.Object aObject,
java.lang.String aContentType)
http://jakarta.apache.org/commons/email/api-release/org/apache/commons/mail/Email.html#setContent(java.lang.Object,%20java.lang.String)


[常見問題3]sent出去的附件中文檔名變成亂碼

在EmailAttachment的物件中的setName方法中,使用MimeUtility的encodeText方法
attachment.setName(MimeUtility.encodeText("中文訊息", "UTF-8", null));

http://java.sun.com/products/javamail/javadocs/javax/mail/internet/MimeUtility.html

2006/08/11

[InfoEngine] Remember to get newOid as you want to update-object


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<ie:unit>
 <ie:webject name="CheckOut-Objects" type="ACT">
  <ie:param name="INSTANCE" data="windchill"/>
  <ie:param name="AUTHORIZATION" data="${@server[]authorization[0]}"/>
  <ie:param name="OBJECT_REF" data="<%=objRef%>"/>
  <ie:param name="GROUP_OUT" data="checkoutDoc"/> 
 </ie:webject>

 <%

 Group checkoutDoc = getGroup("checkoutDoc");;
 String newOid = (String)checkoutDoc.getAttributeValue(0, "obid");
 System.out.println("Checkout Document ends... Update begin, new id");
 System.out.println(newOid);
 %>

 <ie:failure>
 <%System.out.println("no document had been CheckOut");%>
 </ie:failure>

 <ie:success>
 <% System.out.println (getGroup("checkoutDoc").getElementCount() + " document(s) 
 had been CheckOut"); %>
 </ie:success>

</ie:unit> 

<ie:unit>
 <ie:webject name="Update-Objects" type="ACT">
  <ie:param name="INSTANCE" data="windchill"/>
  <ie:param name="GROUP_OUT" data="updateDoc"/>
  <ie:param name="ATTRIBUTE" data="IBA|Revise_By_Drawing"/>
  <ie:param name="OBJECT_REF" data="<%=newOid%>"/>
  <ie:param name="TYPE" data="wt.doc.WTDocument"/>
  <ie:param name="FIELD" data="IBA|Revise_By_Drawing='N'"/> 
  <ie:param name="AUTHORIZATION" data="${@server[]authorization[0]}"/>
 </ie:webject>

 <ie:failure>
  <%System.out.println("no document had been update");%>
 </ie:failure>

 <ie:success>
  <% System.out.println (getGroup("updateDoc").getElementCount() + " document(s) had been updated"); %>
 </ie:success>
</ie:unit>

<ie:unit>

 <ie:webject name="CheckIn-Objects" type="ACT">
  <ie:param name="INSTANCE" data="com.ptc.vm-ase.Windchill"/>
  <ie:param name="ATTRIBUTE" data="IBA|Revise_By_Drawing"/>
  <ie:param name="GROUP_OUT" data="checkInDoc"/>
  <ie:param name="AUTHORIZATION" data="${@server[]authorization[0]}"/>
  <ie:param name="TYPE" data="wt.doc.WTDocument"/>
  <ie:param name="OBJECT_REF" data="<%=newOid%>"/>
 </ie:webject>

 <ie:failure>
  <%System.out.println("no document had been checked-in");%>
 </ie:failure>

 <ie:success>
  <% System.out.println (getGroup("checkInDoc").getElementCount() + " document(s) had been checked-in"); %>
 </ie:success>

</ie:unit>

[InfoEngine] Where to find the compiled InfoEngine Task

You can find the Java files and class files under:
<Windchill_HOME>\tasks\codebase\com\infoengine\compiledTasks